Support » Fixing WordPress » How can I remove these extra lines added inside <head> tags after 2.8 upgrade

  • Resolved TransPersonal

    (@transpersonal)


    What are these lines for:

    <link rel='index' title='myblogname' href='http://www.mysiteurl.com' />
    <link rel='start' title='Current Post Title' href='http://www.mysiteurl.com/CurrentPostTitle/' />
    <link rel='prev' title='Another Post Title' href='http://www.mysiteurl.com/AnotherPostTitle/' />
    <link rel='next' title='Another Post Title' href='http://www.mysiteurl.com/AnotherPostTitle/' />

    What core file do I need to hack to remove them?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Justin Tadlock

    (@greenshady)

    WordPress God

    I don’t recommend doing this because it helps people with disabilities better use your website. But, if you insist, try either one of the methods listed below:

    Method #1: Add this to your theme’s functions.php:

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

    Method #2: Add this to your them’s functions.php:

    add_filter( 'index_rel_link', 'disable_stuff' );
    add_filter( 'parent_post_rel_link', 'disable_stuff' );
    add_filter( 'start_post_rel_link', 'disable_stuff' );
    add_filter( 'previous_post_rel_link', 'disable_stuff' );
    add_filter( 'next_post_rel_link', 'disable_stuff' );
    
    function disable_stuff( $data ) {
    	return false;
    }

    Thanks greenshady, but I was hoping for a core hack to completely remove the code that causes those lines to appear in the first place. Do you know which core file it’s coming from — that’s all I need to know really.

    The functions.php fix would slow down my site (even if in the milliseconds) as it is just another set of extra processes to be handled.

    Justin Tadlock

    (@greenshady)

    WordPress God

    Using functions.php will not slow down your site. And, I would never tell you what core file to edit. Not in a million years (unless I was paid a ton of money, of course).

    You shouldn’t want to edit a core file. That’s just bad practice altogether.

    Thanks man, the functions.php fix does work and will do.

    Hi Guys, do you know how to remove the link rel=’alternate’?

    <
    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.>

    From here: http://wpengineer.com/wordpress-header/

    Thank you Greenshady!!! You help me a lot.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How can I remove these extra lines added inside <head> tags after 2.8 upgrade’ is closed to new replies.