Skip to main content
WordPress made easy with the drag & drop Total WordPress Theme!Learn More

How to Remove WordPress Header “Junk”

Last modified: September 25, 2023

If you look at the source code for your WordPress site you may have noticed a bunch of code (junk) in your <head> tag that is not a part of your WordPress theme such as the the current version number of your WordPress installation, re="alternative" and rel="pingpack".

This is code added by WordPress by default and injected via the wp_head hook. WordPress actually inserts quite a bit of code into your site header, a lot of which is not even needed for your site and may in fact be beneficial to remove.

In order to clean up your WordPress header you will need to create some remove_action functions and I will show you how below!

Skip the bs and take me to the final code.

What is WordPress Header Junk?

Below are some examples of what is added to your header. In my opinion a lot of these are unnecessary and I actually remove them all from my site’s header, which is why I call them “junk”. But it really depends on your site and your needs, so you want to Google search what each of these do before removing them all.

<link rel="alternate" type="application/rss+xml" title="Site Name RSS Feed" href="" />
<link rel="alternate" type="application/atom+xml" title="Site Name Atom Feed" href="" />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="" />
<link rel="pingback" href="" />

How to Clean up Your Header?

WordPress inserts the code into your site head tag via a function name add_action which is used to run functions at specific points (hooks). So to remove the code you will need to use the opposite remove_action function.

remove_action example:

remove_action( $hook_name, $callback, $priority );

Looking at the example above you can see that the remove_action function takes 3 parameters. The hook name, callback and priority. The hook name is the location where the code is being inserted (in this case it will be wp_head), the callback is the original function used to insert the code and the priority is the exact priority used when adding the original action callback.

Sample Snippet:

// Remove rsd link.
remove_action( 'wp_head', 'rsd_link' );

// Remove the WordPress generator tag.
remove_action( 'wp_head', 'wp_generator' );

// Remove RSS feed links.
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );

// Remove the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'wlwmanifest_link' );

// Removes the adjacent post links.
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );

// Removes the WordPress shortlink for your post.
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );

// Remove emoji detection scripts.
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );

Simply paste the code into your child theme functions.php file or via a code snippets plugin to test it out. I’ve commented everything above, but it should also be intuitive to see which action removes what based on the callback function name.

Important: I would never recommend adding this code to a theme for sale or distribution because you are taking away from the end user without their consent. Leave it up to the end user if they want to clean up their site header or not.

Clean Up Your Header using a Plugin

If you rather use a plugin instead of custom code there are a few good ones out there and I would probably recommend using the “WP Head Cleaner” plugin which can be activated on your site to remove unnecessary code from your WordPress site’s head tag.

The WP Head Cleaner plugin includes an options panel so you can choose what does and doesn’t get removed. I downloaded the plugin and took a look at the code and the plugin is coded well, but because the plugin is developed and maintained by a 3rd party developer don’t come after me if you there is an issue!


There isn’t a single WordPress site I run where I don’t add some code to clean up the header to remove WP junk. In my opinion WordPress shouldn’t be forcing things onto the user either and there should be built in settings so you can check what you do and don’t want added to your site header.

Let me know in the comments below if you have any thoughts, feedback or suggestions!


  1. Rajesh Iyer

    Hi AJ,

    Can you help me understand how to remove the Next links and the previous links which comes on every post. I read on some of the sites including this that we have to insert this code on functions.php file:
    remove_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 );

    I am not a techie and only handle wordpress a little bit from its dashboard. I would really appreciate if you could tell me where exactly to put this line of code. I mean after which line and before which line on functions.php file?


    Rajesh Iyer

    • AJ Clarke

      Hi Rajesh,

      This depends on your theme, for example on some of my premium themes (like Total) there is an option built-in to the theme panel to disable it. On other themes there might be a filter you can hook into or a function to override. And as a last resort you can removing it by hiding it with CSS. But it all depends on the theme you are using. If you are using a premium theme just message the author and they should be able to help you out!

  2. sama web solutions

    thank you AJ Clarke ..
    helpful post

  3. omnisite2

    You can also use a plugin to remove it and many more stuff from the header. There are some, but I use this one:

    • AJ Clarke

      Definitely a plugin may be a good idea if you are using a 3rd party theme. If you are creating your own custom theme for your personal site then having the code in your theme is better because you never know what a 3rd party developer may do in an update.

    • Paulo

      what different from littlebizzy remove??

      • Kyla

        They look like they could be pretty similar – so since Remove WordPress Overhead hasn’t been updated in quick a while, the Header Cleanup plugin could be a good alternative.

Leave a Reply

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

Learn how your comment data is processed by viewing our privacy policy here.