Cleanup WordPress Header

WordPress implements new standard features in the head of the theme since version 2.5, that are always on the hook wp_head. Even in WordPress 2.8 new functions were added. If you don’t need them you can easily disable them by using the function remove_action.

Function remove_action

remove_action( $tag, $function_to_add, $priority, $accepted_args );

This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific action hook and possibly replace them with a substitute.

Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.
via: WP Codexy

The following syntax shows an excerpt, only a part of the output you can have in your theme. They result from the standard functions, which are loaded in the head of the theme. Visible, if you search in the file wp-includes/default-filters.php for the Hook wp_head. Not all filters should be deactivated, because in most cases they are useful. But WordPress is not only as classical blog in use and therefore some functions are not necessary.

<link rel="alternate" type="application/rss+xml" title="WP Engineer RSS Feed" href="" />
<link rel="alternate" type="application/atom+xml" title="WP Engineer Atom Feed" href="" />
<link rel="pingback" href="" />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="" />
<link rel='index' title='WP Engineer' href='' />
<link rel='start' title='Use WordPress 2.7 Offline' href='' />
<link rel='prev' title='Recents Drafts All Authors' href='' />

This is an example, not a recommendation where some functions are deactivated. Check your header and turn off what you don’t need. Less markup and better loading time.

remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Display relational links for the posts adjacent to the current post.
remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version





11 responses to “Cleanup WordPress Header”

  1. Hon tap Avatar

    Cool. This hack may help WP blog run faster and hide some information from curious people. Very useful. Thank you very much.

  2. Arpit Jacob Avatar

    referring to Hon statement about will it actually effect the speed in which WordPress renders pages?

  3. David Avatar

    Looks useful, but I guess I have to look up what some of these functions do before I remove them.

    I’m currently making a CMS type site and I’ll probably try and find some way to disable that RSS feed. No need to have anything broadcasting.

  4. James John Malcolm Avatar

    Having less in your head, and especially less links to look up/load will always be beneficial.

    Thanks WP Engineer!

  5. Joe Howard Avatar

    Thanks so much for this tip! Any little piece I can save to optimize wordpress is so helpful. Thanks again! 🙂

  6. Vayu Avatar


    Thanks, this i very helpful!

    I have several plugins that add extra meta tags in the header that I also would like to have control over.

    For example I use the NextGen gallery and this is added in the header:

    How can I remove this?


  7. Alex Avatar

    This is not possible in an easy step, it is always depending on the Plugin. It’s not possible with NextGEN, you have to contact Alex Rabe, the author of NextGEN

  8. Korrekt Avatar


    ‘adjacent_posts_rel_link’ has changed to ‘adjacent_posts_rel_link_wp_head’ in WP 3.0


  9. Martina Avatar

    Thanks, Korrekt 😉

    this brought me also to the idea to use parent_post_rel_link_wp_head and start_post_rel_link_wp_head, because the above version without _wp_head did not work, too.

  10. Chris Avatar

    remove_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’ );

    this worked for me whereas


    did not. I am using wordpress MU

  11. stanislav Avatar

    adjacent_posts_rel_link – not exist in wordpress 3,
    right – adjacent_posts_rel_link_wp_head
    mistake ?