Remove These 10 Unnecessary Tags from WordPress Header (WP Version, Prev, Pingback, Feed Links & More)

WordPress auto generates a whole lot of unnecessary tags/elements that can not only slow down your website but also in some cases cause security issues. For instance, the WP Generator header tag gives away the current version of your WordPress site which is definitely not something that you want to reveal. So let's see what these elements are and how to remove them.

List of Unnecessary Elements in WordPress Header

Here is a list of auto-generated header tags that we will be removing (Of-course it goes without saying that not all these functions need to be removed. Remove whatever you feel is unnecessary and keep the rest.):

<link rel="profile" href="">
<link rel="pingback" href="#">
<link rel="alternate" type="application/rss+xml" title="Comments Feed" href="#" />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="wlwmanifest.xml" />
<link rel='prev' title='#' href='#' />
<link rel='next' title='#' href='#' />
<meta name="generator" content="WordPress 4.1.1" />
<link rel='shortlink' href='#' />
<link rel='index' title='#' />
<link rel='start' title='#' />

Luckily removing these elements is very easy. All you need to do is open you theme's functions.php file and add a few lines of code to it.

1.) Removing XMLRPC, WLW, Generator, Feeds and ShortLink

To remove these tags, just add the following to your theme's functions.php page:

remove_action('wp_head', 'rsd_link'); //removes EditURI/RSD (Really Simple Discovery) link.
remove_action('wp_head', 'wlwmanifest_link'); //removes wlwmanifest (Windows Live Writer) link.
remove_action('wp_head', 'wp_generator'); //removes meta name generator.
remove_action('wp_head', 'wp_shortlink_wp_head'); //removes shortlink.
remove_action( 'wp_head', 'feed_links', 2 ); //removes feed links.
remove_action('wp_head', 'feed_links_extra', 3 );  //removes comments feed. 

2.) Removing Previous and Next Article Links

Previous and next article links can be removed by adding the following code to functions.php file:

/*Removes prev and next links*/
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
Important Note 1: The 'Prev' and 'Next' tags are important for 'paginated pages (archive pages, category pages, tag pages, paginated homepage etc.)' as they help Google Bot identify if the page in question is part of a paginated sequence. Hence these tags can help prevent content duplication issues.

Here's what Google says, "You can use the HTML attributes rel="next" and rel="prev" to indicate the relationship between individual URLs. Using these attributes is a strong hint to Google that you want us to treat these pages as a logical sequence." Read more here.

But oddly enough, wordpress adds these tags to all 'single post pages' (where these tags are not required) and fails to add the tags to 'paginated pages (archive pages, category pages, paginated homepage etc.)' where these tags are actually required!

This is why we can safely remove these tags using the above code. You can also add these tags to paginated pages (archive pages, category pages, paginated homepage etc.) by following this tutorial:

Important Note 2: This won't be applicable to everyone, but if you are splitting your single posts using the <!--nextpage--> tag, then you can add the rel='next' and rel='prev' tags using this tutorial:

3.) Removing XFN (XHTML Friends Network) Profile Link and Pingback URL

The rel=profile link and rel=Pingback tags can be removed directly by editing the header.php file. To do this, open your template's header.php file and remove the following lines:

<link rel="profile" href="">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">

Creating a Plugin to Perform the Above Actions

Editing your theme's Header.php or Functions.php is an easy way to achieve certain functionalities, but the downside to this is that you would need to make all these changes over and over again if you were to change your theme or if the theme gets updated and you were not using a child theme. So to make these functions theme independent, it is optimal to use a plugin. Plugins once activated will keep working irrespective or the theme you use.

So here's how you can create a plugin to carry out the above actions:

Step 1: Open your favorite text editor. I recommend Notepad++.

Step 2: Add the following code to a blank file and save it as 'your-plugin-name.php' after making necessary edits:

Plugin Name: Your plugin name goes here.
Plugin URI: Your website/blog address goes here.
Description: Removes unnecessary clutter from WPHead.
Version: 1.0.0
Author: Your name goes here.
Author URI: Your website/blog address goes here.

/*Removes RSD, XMLRPC, WLW, WP Generator, ShortLink and Comment Feed links*/
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action( 'wp_head', 'feed_links', 2 ); 
remove_action('wp_head', 'feed_links_extra', 3 );

/*Removes prev and next article links*/
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');

Step 3: Upload this file to your wordpress installments plugin directory.

Step 4: Activate the plugin from your dashboard by going to Plugins > Installed Plugins.

So this is how you can create a plugin to carry out similar actions.

Please Note: As mentioned before, not all these elements need to be removed as some of them are pretty useful when it comes to blog management. For instance, if you use the windows live writer to blog then you might not want to remove the wlwmanifest link.

Removing extra lines from wp-head
WordPress Function Reference - Remove Action

Hey guys, I just released my SEO plugin Quick and Easy SEO Tool which is currently available for download. I designed this plugin with simplicity in mind and I am really happy with the way it has turned out. Please do download and checkout the plugin from the wordpress repository here:

And yes, the plugin has the option to remove all these unwanted tags.

You can also download the plugin from your wordpress dashboard by searching for 'Quick and easy seo tool by Mukesh Mani'. Your feedback is appreciated.

Here's an article I wrote detailing the plugin:

Thank you!



  1. Alex says:

    Thanks! This was very useful.

  2. Mukesh says:

    No problem Alex, glad it was useful.

  3. Abbass says:

    hi, this was very useful for me, thanks a lot.

  4. Sagar Patil says:

    Can you make post about all this tags and what are use of this, so we can understand which one to remove and which not. Please.

    • M Mukesh says:

      Hi Sagar, Sure, will update this post with the information you asked for.

  5. Robz says:

    There is no reason to remove rel="next" and rel="prev" if you have paginated content on your website. See:

  6. Carlos Santos says:


    How to remove the information that is displayed when you access sites such as:

    I need to remove the information: Link ; rel=shortlink

    I used the code:

    remove_action('wp_head', 'wp_shortlink_wp_head');

    And it does not work.

    • Sebastien Shirao says:

      I think you've got the solution by now, but if not try this. It's just an error in your syntax, the right code is:

      remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );

      Best regards.

    • Jim S Smith says:

      As WordPress v5.2 + (at least by my experimentation),

      I've also had to use:

      remove_action( 'template_redirect', 'wp_shortlink_header', 11, 0 );

      In order to remove the "left-over" shortlink token from the "Link:" response header.
      Apparently, when switching my servers over to use PHP-FPM, instead of MOD_PHP to output my site, my .htaccess directive: "Header unset link" NO LONGER WORKED!

      So I hope this helps any lingering problems, especially with the new WordPress versions.

      ( Just wish the developers would think about the rest of us, before casually adding stuff we may not need nor want! )

      - Jim S.

  7. dividesign says:

    I appreciate this. Thanks a bunch!

  8. Hi, this was very useful for me, thanks a lot.
    How can i remove this code using wp_head().
    .recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}

  9. Hitesh Bhasin says:

    Not an affiliate. But perfmatters plugin does a fantastic job of removing many useless things like these as well as heartbeat control.

  10. Laura B. says:

    Thank you!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.