Buddypress with yoast plugin. Incorrect canonical url.

Not so long time ago I’ve completely disappointed with All in One SEO Pack plugin which I usually use for SEO purpose. Previously it has many feature which were easy executable by adding another plugins of the top of All in One SEO Pack, but with each new version they transferred slowly into professional version, making my existing All in One SEO Pack nonfunctional after it’s upgrade or upgrade other plugins. So I completely moved to Yoast SEO. So it was like a new level of SEO management for WordPress, but unfortunately not for buddypress which was installed in my several project. The main headache appeared to be with Buddypress groups and Buddypress members. Every group and member profiles processed by Yoast generates in code incorrect canonical url, usually chopped to http://yoursite.com/members, but not http://yoursite.com/members/membername, what causes complete exclusion for scanning by Google and other search engines.

I’m not a PHP developer, but after tearful researches I found where to make changes to fix buddypress yoast  canonical.

So I edited theme function.php

# Yoast canonical for buddypress

function wpseo_canonical_exclude( $canonical ) {
global $bp;
if ( $bp->current_component) {
$canonical = false;
}
return $canonical;
}
add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );

# end of yoast canonical for buddypress

 

Now all my groups and members are properly processed by Yoast SEO. Great thanks for developer who made this plugin. I hope you will take it in account for the future version.

3 Comments

  1. We absolutely love your blog and find almost all of your post’s to be precisely what I’m looking for.
    can you offer guest writers to write content for you?

    I wouldn’t mind creating a post or elaborating on most of the subjects you write
    regarding here. Again, awesome site!

    Reply
  2. Tһank’s a lot foг discussing with youг blօg
    post, seriously that iѕ some thing various witһ other
    Ƅlog, and i have been long time research concerning this blog post.
    i hɑve faith you try to keep producing like this and more a lоt better .

    The almighty Bless you.

    Reply

Leave a Reply to domain Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.