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:
- 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.
- WP Embed: If you’re not using WordPress embeds, you can safely remove this tag.
- jQuery Migrate: If you’re using an up-to-date version of jQuery, you can safely remove this tag.
- 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.
- 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.
- Shortlink: This tag is used to display a shortlink to your page. If you’re not using it, you can safely remove this tag.
- Prev/Next Links: If you’re not using these links to navigate between pages, you can safely remove these tags.
- Feed Links: If you’re not using RSS feeds, you can safely remove these tags.
- Pingback Link: If you’re not using pingbacks on your website, you can safely remove this tag.
- 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.