Friday , April 26 2024

10 WordPress Header Tags That Can be Safely Removed to Improve Page Speed

Removing unnecessary tags from the WordPress header can definitely help to improve page speed. Here are some of the tags that can be safely removed:

  1. Emoji scripts: WordPress adds several scripts to handle emojis on your website. If you’re not using emojis on your website, you can safely remove these scripts.
  2. WP Embed: If you’re not using WordPress embeds, you can safely remove this tag.
  3. jQuery Migrate: If you’re using an up-to-date version of jQuery, you can safely remove this tag.
  4. RSD Link: This tag is used to enable Really Simple Discovery for your blog. If you’re not using it, you can safely remove this tag.
  5. WLW Manifest Link: This tag is used to enable Windows Live Writer manifest. If you’re not using this software, you can safely remove this tag.
  6. Shortlink: This tag is used to display a shortlink to your page. If you’re not using it, you can safely remove this tag.
  7. Prev/Next Links: If you’re not using these links to navigate between pages, you can safely remove these tags.
  8. Feed Links: If you’re not using RSS feeds, you can safely remove these tags.
  9. Pingback Link: If you’re not using pingbacks on your website, you can safely remove this tag.
  10. WordPress Version: Displaying your WordPress version can be a security risk. If you’re not using it for any specific reason, you can safely remove this tag.

To remove these tags, you can use a plugin like “WP Remove Header” or add the following code to your functions.php file:

function remove_unnecessary_tags() {
    remove_action('wp_head', 'wp_generator');
    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'rsd_link');
    remove_action('wp_head', 'wp_shortlink_wp_head');
    remove_action('wp_head', 'feed_links', 2);
    remove_action('wp_head', 'feed_links_extra', 3);
    remove_action('wp_head', 'rest_output_link_wp_head', 10);
    remove_action('wp_head', 'wp_oembed_add_discovery_links', 10);
    remove_action('wp_head', 'wp_resource_hints', 2);
    remove_action('wp_head', 'wp_print_styles', 8);
    remove_action('wp_head', 'start_post_rel_link', 10);
    remove_action('wp_head', 'wp_print_head_scripts', 9);
    remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10);
    remove_action('wp_head', 'wp_oembed_add_host_js');
}
add_action('init', 'remove_unnecessary_tags');

Note:

Removing unnecessary tags can improve page speed, but it’s important to do it carefully and only remove the tags that you’re not using. Removing necessary tags can break your website or cause unexpected issues. Always make a backup of your website before making any changes.

Check Also

How to Remove the Shortlink from the HTTP Header in WordPress Without Plugin

The format of shortlink is very simple. It contains your domain name and page ID. …

Leave a Reply

Your email address will not be published. Required fields are marked *