How To Fix BuddyPress Titles When Using Yoast SEO

Home » WordPress Tutorials » How To Fix BuddyPress Titles When Using Yoast SEO
  • yoast seo

How To Fix BuddyPress Titles When Using Yoast SEO

Yoast SEO is one of the most popular WordPress SEO plugins. While it would be great to have native support for BuddyPress out of the box, it does not. If you have BuddyPress installed with Yoast SEO, you will get a notice in the webmaster tools. The titles for each member’s profile will all be the same. The same thing happens for each of the sub-pages (settings, activity, etc) which will also have the same title.

Here is How to Fix the Issue

There is no option within the Yoast SEO settings to restore the titles or manage the SEO settings for any BuddyPress page or BuddyPress content. Therefore to fix this issue, you will have to insert code that we have written to restore those titles.

/**
 * Removes WordPress SEO Title Filter On BuddyPress Pages
 *
 * @version 1.0.0
 * @since 1.0.0
 * @return void
 */

if ( defined('BP_VERSION') ) {

function sert_remove_bp_wpseo_title() {
 if ( function_exists( 'wpseo_auto_load' ) && function_exists( 'bp_is_blog_page' ) 
 && ! bp_is_blog_page() ) {
 $wpseo_instance = WPSEO_Frontend::get_instance();
 remove_filter( 'pre_get_document_title', array( $wpseo_instance, 'title' ), 15 );
 }
 }
 add_action( 'init', 'sert_remove_bp_wpseo_title' );
 }

The above code can be safely added to the following files:

  • functions.php file
  • site-specific plugin

After this code is added to one of those files, the titles will be restored. You will not be able to edit the titles because this code only disables the plugin from re-writing the title tags on the given pages.

Whether or not we can expect a more long-term fix or not is not something we can answer right now. In the future we are hoping to see a day where Yoast SEO can work together with BuddyPress SEO.

If you have questions regarding this code or need help, please feel free to contact us!

By | 2017-12-19T20:13:18+00:00 December 19th, 2017|Categories: WordPress Tutorials|Tags: , , |0 Comments

About the Author:

Scott Hartley is a WordPress Developer who focuses on website performance optimization, SEO, and security. He can't tell you what a color wheel is but he knows the intricacies of making a website load quickly.

Leave A Comment