The WordPress SEO plugin from Yoast is pretty much the only SEO solution you need for your WordPress site. It has become a default plugin in all my WordPress and BuddyPress projects. The only issue is that the plugin hooks into the common wp_title template tag to rewrite your site URLs to a custom title (that you specify from the WordPress SEO settings). BuddyPress does not use this tag, and thus the URL rewriting does not work. Below is a quick snippet that will fix this problem for you.

Find the following code in header.php of your Child Theme (around line 9):

[php]<title><?php bp_page_title() ?></title>[/php]

And replace it with the following snippet:

[php] <?php if(!bp_is_blog_page()){ ?>
<title><?php bp_page_title() ?></title>
<?php } else { ?>
<title><?php wp_title(”) ?></title>
<?php } ?>

WordPress SEO is now working as it should. Enjoy!

36 thoughts on “Making BuddyPress compatible with the WordPress SEO plugin from Yoast

Author gravatar

I am using a BP child of theme hybrid framework. At header.php shows

Should I replace “” with “” in the code above ?


Author gravatar

A very good list. I really like the list as I am always searching for additional plugins to make my site more effective.

thank you for this valuable info..

Author gravatar


Is there a way to add specific sitemap support for the buddypress activity stream? For my site, the activity stream, and member’s profile pages should be my highest priorities. However, with yoast seo and this snip, neither show in any of the sitemaps.

Author gravatar

Thanks for the quick fix! Yoast is the man and glad you found a buddypress workaround for his SEO plugin.

Author gravatar

It’s not working for the activity stream:
Submitted URLs
967 URLs in web index

URLs not followed
When we tested a sample of URLs from your Sitemap, we found that some URLs redirect to other locations. We recommend that your Sitemap contain URLs that point to the final destination (the redirect target) instead of redirecting to another URL.

Is there any way to fix this?

Author gravatar

Thanks for the trick ! I just migrate from All In One SEO to Yoast Wordrpress and as I’m using BuddyPress I’m very happy 😉

Author gravatar

I had a similar problem with themes generated using Artisteer. My solution was to write a function called bw_wp_title(). This works out what to do depending on whether or not WordPress SEO is activated.

* return a nice SEO title
* taking into account which plugins are being used
if ( !function_exists( ‘bw_wp_title’ )) {
function bw_wp_title() {
if ( class_exists( ‘WPSEO_Frontend’ )) {
$title = wp_title(”, false );
}else {
$title = wp_title( ‘|’, false, ‘right’ );
$title .= get_bloginfo( ‘name’ );
return $title;

I included this in functions.php for the ( child ) theme. I then changed header.php to echo the result of bw_wp_title(), commenting out the original code.
Note: The bw_wp_title function is wrapped in “if not function exists” so that I can implement the same or better version of this function in my oik plugin.

Author gravatar

This fix isn’t working for my site

When I change I code in header, all the pages works perfectly but Activity, Groups and Members pages. These pages are mixing up the titles.

How do I prevent buddypress specific pages from being rewritten by this plugin?

Author gravatar

Ola! Bowe,
This might be off topic, however WordPress SEO is not difficult provided a simple process is followed. When considering WordPress SEO a few common questions are:
Great Job!

    Author gravatar

    Good day! I simply would like to give an emrnoous thumbs up for the great info you will have right here on this post. I will likely be coming again to your weblog for extra soon.

Author gravatar

If you could email me with some hints & tips about how you made this blog look this good , I would appreciate it!

    Author gravatar

    Bonjour, This blog is very interesting and fun to read. I am a enouumors follower of the topics blogged about. I also love reading the replies, but it seems like that most of people need to stay on topic to try and give more to the original topic. I would also encourage all of you to add this website to your favourite website to help get the word out. Warm Regards

Author gravatar

I have got one suggestion for your webpage. It looks like there are a couple of cascading stylesheet problems when opening a selection of webpages in google chrome and internet explorer. It is operating fine in internet explorer. Possibly you can double check this.

    Author gravatar

    May 8, 2012Currently I am wiorkng on Buddypress User Account Type PRO, just after that I’ll start wiorkng on, it may take 3.5 more weeks to release it.hmm.. about multiple user community, it is not hard to do with Buddypress. basically, buddypress is built to do that. it doesn’t remove any wordpres feature, just extend it to a multiple user community. after installing Buddypress, Authors can write and publish post just like before, so.. it is not hard anymore.Thanks

Author gravatar

Do youve a spam problem on this internet site; I also am a blogger, and I was questioning your situation; we now have developed some great techniques and we are looking to trade solutions with other folks, be positive to blast me an e-mail if planning to pursue.


These instructions seem easy.However, I have just a question or two.In, “To Publish Content on your Website”, you wrote, “If your network has a name resolution system (typically DNS), then visitors can simply type your computer name in the address b…

Author gravatar

Well, your trick is not working with the recent versions of Buddypress (1.6.1) and WordPress SEO by Yoast ( I figured out how to solve it at my site ( It´s not a elegant solution, because I´m not a programmer, but it´s working. I´m sharing to see if I get some improvements.

So, to make Buddypress titles work while WordPress SEO by Yoast plugin is activated, just add this to your theme´s functions.php:

add_filter('wpseo_title', 'mood_bp_title');
function mood_bp_title($title) {
if ( function_exists('bp_current_component') && bp_current_component() ) {
global $bp;

// If this is not a BP page, just return the title produced by WP
if ( bp_is_blog_page() )
return $title;

// If this is the front page of the site, return WP's title
if ( is_front_page() || is_home() )
return $title;

$title = '';

// Displayed user
if ( bp_get_displayed_user_fullname() && !is_404() ) {

// Get the component's ID to try and get it's name
$component_id = $component_name = bp_current_component();

// Use the actual component name
if ( !empty( $bp->{$component_id}->name ) ) {
$component_name = $bp->{$component_id}->name;

// Fall back on the component ID (probably same as current_component)
} elseif ( !empty( $bp->{$component_id}->id ) ) {
$component_name = $bp->{$component_id}->id;

// Construct the page title. 1 = user name, 2 = seperator, 3 = component name
$title = strip_tags( sprintf( _x( '%1$s %3$s %2$s', 'Construct the page title. 1 = user name, 2 = component name, 3 = seperator', 'buddypress' ), bp_get_displayed_user_fullname(), ucwords( $component_name ), $sep ) );

// A single group
} elseif ( bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) && !empty( $bp->bp_options_nav[$bp->groups->current_group->slug] ) ) {
$subnav = isset( $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] ) ? $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'] : '';
// translators: "group name | group nav section name"
$title = sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp->bp_options_title, $subnav );

// A single item from a component other than groups
} elseif ( bp_is_single_item() ) {
// translators: "component item name | component nav section name | root component name"
$title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), $bp->bp_options_title, $bp->bp_options_nav[bp_current_item()][bp_current_action()]['name'], bp_get_name_from_root_slug( bp_get_root_slug() ) );

// An index or directory
} elseif ( bp_is_directory() ) {
if ( !bp_current_component() ) {
$title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() );
} else {
$title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() );

// Sign up page
} elseif ( bp_is_register_page() ) {
$title = __( 'Create an Account', 'buddypress' );

// Activation page
} elseif ( bp_is_activation_page() ) {
$title = __( 'Activate your Account', 'buddypress' );

// Group creation page
} elseif ( bp_is_group_create() ) {
$title = __( 'Create a Group', 'buddypress' );

// Blog creation page
} elseif ( bp_is_create_blog() ) {
$title = __( 'Create a Site', 'buddypress' );

// Some BP nav items contain item counts. Remove them
$title = preg_replace( '|[0-9]+|', '', $title ); }

return apply_filters( 'bp_modify_page_title', $title . ' ' . $sep . ' ', $title, $sep, $seplocation );

    Author gravatar

    Tried your solution and it worked. I did notice however that the Groups > Member list (group members not main member directory) title shows a at the end of the title.. otherwise very cool snippet!

Author gravatar

Can anyone tell me if this enables the indexing of my group forums topics in sitemap.xml? Regards!

    Author gravatar

    No it does not. Since BuddyPress does not use custom post types for groups, the sitemap will not pick them up.

Author gravatar

For buddypress 2.2.1 you can try this one
* Fix wpseo title
add_filter(‘wpseo_title’, ‘buddypress_wpseo_title’);

function buddypress_wpseo_title($title) {
$wpseo = WPSEO_Frontend::get_instance();
$separator = $wpseo->options[‘separator’];

$separator_options = array(
‘sc-dash’ => ‘-‘,
‘sc-ndash’ => ‘–’,
‘sc-mdash’ => ‘—’,
‘sc-middot’ => ‘·’,
‘sc-bull’ => ‘•’,
‘sc-star’ => ‘*’,
‘sc-smstar’ => ‘⋆’,
‘sc-pipe’ => ‘|’,
‘sc-tilde’ => ‘~’,
‘sc-laquo’ => ‘«’,
‘sc-raquo’ => ‘»’,
‘sc-lt’ => ‘<‘,
‘sc-gt’ => ‘>’,

if (array_key_exists($separator, $separator_options)) {
$separator = $separator_options[$separator];
$bp = buddypress();
if (bp_is_user()) {
$title = bp_get_displayed_user_fullname() . ‘ | ‘ . ucfirst($bp->current_component);
} elseif (bp_is_group()) {
$title = bp_get_current_group_name() . ‘ | ‘ . $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()][‘name’];

return $title . ‘ ‘ . $separator . ‘ ‘ . get_bloginfo();

Leave a Reply

Your email address will not be published. Required fields are marked *