Support » Plugins » Hacks » Remove Post Relational Links from wp_head

  • Grrrr.

    Can anyone please help us get rid of the Post Relational Links links from the wp_head?

    we want to remove the code that produces the
    <link rel=’prev’ title=” href=” />
    <link rel=’next’ title=” href=” />

    this constantly places outdated pages in the head and it’s affecting our SEO.

    Please note that we have already tried placing this in our functions.php and it does not remove it…

    remove_action(‘wp_head’, ‘start_post_rel_link’);
    remove_action(‘wp_head’, ‘adjacent_posts_rel_link’);


    anyone that can help us goes on our awesome list for sure 😀

Viewing 13 replies - 1 through 13 (of 13 total)

    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.

    The original actions look like so..

    add_action( 'wp_head',             'start_post_rel_link',           10, 0 );
    add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );

    Your remove action priorities must match that of the original actions(which i’ve posted above for you).


    we really appreciate the help – thank you truly – however, we are not programmers :\ Our knowledge of php is enough to edit what we are told to edit.

    Your answer is a little over our heads… is there anyway to dumb it down for us? :D:D 😀

    We mean basic like…

    “post this exact code in this file” or “remove this exact code in this file”

    Sorry – we’re very php un-intelligent.

    Thank you! 😀

    Add the remove action code to your theme’s functions.php file, eg. wp-content/themes/YOUR_THEME/functions.php

    Adding the priorities that match the original actions.. like so..

    remove_action('wp_head', 'start_post_rel_link', 10, 0 );
    remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);

    Add the code after the first <?php on a new line, so the top of the file now looks like so..

    remove_action('wp_head', 'start_post_rel_link', 10, 0 );
    remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);

    Hope that helps..

    So Sorry – we truly appreciate your help – but this is still not making any sense to us.

    We get what your saying process wise, but this still requires us to figure out what code the original action is in our file – which we can’t. We don’t know what’s causing these links to be there – so we can’t respond to it with a removal code.

    this code does not exist in our functions.php file…

    add_action( ‘wp_head’, ‘start_post_rel_link’, 10, 0 );
    add_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 );

    so adding this…

    remove_action(‘wp_head’, ‘start_post_rel_link’, 10, 0 );
    remove_action(‘wp_head’, ‘adjacent_posts_rel_link’, 10, 0);

    doesn’t work :\

    What we really need is someone who knows the exact code we need to add or remove in the specific file of WordPress version WordPress 3.0.1.

    So sorry, we’re just not programmers, so we do not know how to decipher what code causes what… we really need a clear cut or paste answer if anyone has it?

    Thank you!

    NO WONDER!!!!

    YAY! For anyone else having this issue we found it on another message board.

    Thank you for you help Mark / t31os but we found out that the answer you were giving us applies to older versions of WordPress. We are using 3.01 and we found on another message board that this code was removed from functions.php after version 3.0.

    Here is the answer…

    To remove these links from your wp_head you need to go to:


    all of these head links can be found in…

    // Actions

    we removed…

    add_action( ‘wp_head’, ‘parent_post_rel_link’, 10, 0 );
    add_action( ‘wp_head’, ‘start_post_rel_link’, 10, 0 );
    add_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10, 0 );

    and voilà! annoying links gone.

    We don’t know if those links are important for other functions, but it is not causing anything to go wrong on our site.

    Hope this helps someone else! 😀

    For clarity, all you needed to do was add the code i provided to your theme’s functions file(save the changes), nothing more..

    Editting WordPress core files, such as the default filters will mean you’ll lose the changes with each upgrade.

    hmmm – one problem though – the links were not responding to adding the code you provided :\ We read where other people were not getting a response from that code either. We tried several times and that code does not remove the links, so we did not know what else to do :\.


    I had some problems with this too (search engines found some pages I wanted to hide…)

    Found the answer on

    which says that adjacent_posts_rel_link was renamed to adjacent_posts_rel_link_wp_head in version 3.0.

    This works:
    add_action( 'wp_head', 'parent_post_rel_link_wp_head' );

    You could be on to something there, the code i posted might be hooking onto the wrong action(s)..

    I’ll have to go back and check that for you folks tomorrow.. thanks for pointing that out.. 🙂

    Indeed the suggested change to the naming is correct, the following two actions correctly remove the appropriate two links..

    remove_action('wp_head', 'start_post_rel_link', 10, 0 );
    remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);

    Huge thank to everyone in this thread for sticking with it to find the right solution for WP 3.0 – I also needed to remove those links and the old instructions just wasn’t working….

    Very happy now!

    yes, HUGE thank you for the solution. having those stupid links took us from a google page 1 result where we had been for 2 years, to a page 2. WP really needs to take this out of default because it’s terrible for seo.

    but THANK YOU to everyone on here who contributed. we truly do appreciate it. 😀

    Thank you, all. Just what I was looking for!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Remove Post Relational Links from wp_head’ is closed to new replies.