1

There is a major problem with most new templates for WordPress that want you to set your homepage to Your Latest Posts.

This is to enable many of the great theme features to work.

The problem with this is that the front page (even though not a blog page) is seen as a paged entity by the wordpress core and yoast seo too.

So what does this mean?

You have a homepage www.mysite.com if you visit your page and look inside the source code you see rel="next" href="hxxps://www.mysite.com/page/2/"

If you actually click that /page/2 link you will see it takes you right back to your front page except this time if you look in the source code it now has rel="prev" href="hxxps://www.mysite.com/" and rel="next" href="hxxps://www.mysite.com/page/3/"

If you click the link to /page/3/ now and once again inspect the source code you will see rel="prev" href="hxxps://www.mysite.com/page/2/" and rel="next" href="hxxps://www.mysite.com/page/4/"

This goes on and on and is not something an end user will ever see but is very bad for search engines especially Google who will possibly see this as duplicate content.

I have been in support talks with Yoast for several weeks on this issue and they are adamant it's a theme problem and blames theme developers not using wp_enqueue correctly. For the most part I believe it is but it also means that a great majority of the most popular wordpress themes out there have this very same problem.

The only current way around this is to go into reading settings in wordpress and set your front page to a static page and your posts page to your posts page. Easy but you lose all the nice functionality of a really great template you just spent a week customizing or even paid good money for.

So while that may be a solution, it's not really a solution and it seems most theme developers do not know how to get around this.

I have had this problem with my past theme Tempera, I switched to a few new themes from GraphPaperPress and then also tried out one of the most popular themes Zerif and they all have this problem.

I have tried all sorts of code snippets in functions.php and I can get the rel=next and rel=prev to not display on the front page but then it also does not work on every other page like the /blog/ page where do you want these meta links and also on all the category pages which also need the rel=next and rel=prev links in order to tell search engines to keep crawling deeper.

I can do this switch to a static front page and get a decent looking front page, similar to the themes dynamic front page but there is so much functionality lost and its rather depressing to have to settle for less, especially with all the wonderful ajaxy and parallaxy things that are available today.

So is there actually a simple function to remove it from the home page only but to have it appear on pages like /blog/ /category1/ /category2/

Here are some I have tried but I am just not getting the conditional statements right or I am doing something else wrong but its been too long diagnosing this now and I think I am losing my mind for sure.

function wpseo_disable_rel_next_home( $link ) {
  if ( is_home() ) {
    return false;
  }
}
add_filter( 'wpseo_next_rel_link', 'wpseo_disable_rel_next_home' );

and

function genesis () {
if ( !is_home() || !function_exists( 'genesis' ) )
            $this->adjacent_rel_links();
}

and

if ( is_front_page() && is_home() )
{
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
remove_action(‘wp_head’, ‘cor_rel_next_prev_pagination’);
}

Hope someone can solve this riddle. Anyone wanting to test this out can download the Zerif theme and make sure Yoast is installed too. Use their dynamic front page system and then create a blog page for a separate blog listing page.

2

Here is the answer:

function bg_disable_front_page_wpseo_next_rel_link( $link ) {
    if ( is_front_page() ) {
        return false;
    }

    return $link;
}
add_filter( 'wpseo_next_rel_link', 'bg_disable_front_page_wpseo_next_rel_link' );

You have to return the $link, if you return nothing it will disable it for every single page...

  • worked like pro :) – Frank Dec 13 '18 at 10:36
0

I see you already tried with wpseo_next_rel_link can try with this one more time.

function wpseo_disable_rel_next_hom () {
  if ( is_home() || is_front_page() ) {
    return '';
  }
}
add_filter('wpseo_next_rel_link', 'wpseo_disable_rel_next_hom');

And one more thing as per as I know that is not Yoast SEO plugin issue. You can try with WordPress Default theme and then you will see the different.

  • Tried that and it does work like above code snippets to remove it from the front page but then all other pages like /blog/ and /category/ do NOT have the rel=next link where it is actually needed. Need some code as above but code that can add it back to categories, archives and blog page not just remove it. I know its not a Yoast issue, more of a wordpress issue actually but there has to be a solid workaround for this. See if you can try make it add the rel=next to a page called "blog" – MitchellK Jul 16 '16 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.