Can’t seem to work on Yoast SEO plugin
-
Hi,
We’re trying to use Yoast on BuddyPress pages (e.g. activity page, members’ directory, etc.) and it seems like setting for title, meta description, open graph, etc. are not taking effect. The meta’s are not outputted in the source. On non buddypress pages everything is fine. Can you please advice what we need to do?
-
It’s quite probable it just won’t work. BuddyPress intentionally interferes with the page that WordPress thinks its loading (when it’s a BuddyPress URL), and I suspect Yoast SEO will look at this page object, and because we’ve messed with it and because it doesn’t map to a real WordPress Page, it won’t work.
Sorry!
Are there any suggested workarounds?
If you like to keep using Yoast for WordPress pages and exclude BuddyPress from using Yoast, you may try this.
function wpseo_fix_title_buddypress($title) { // Check if we are in a buddypress page if ( function_exists( 'buddypress') && ( !empty( buddypress()->displayed_user->id ) || !empty( buddypress()->current_component ) ) ) { $bp_title_parts = bp_modify_document_title_parts(); // let's rebuild the title here $title = $bp_title_parts['title'] . ' ' . $title; } return $title; } add_filter( 'wpseo_title', 'wpseo_fix_title_buddypress');
Thanks @mairaj!
I just pasted it as is into my bp-custom.php and it worked a treat.
Thanks @mairaj
Your suggestion is working perfectly@mairaj Thanks for your solution, seems to be working great. One thing though, I noticed my group forum topics still don’t display. The seo meta title is just the name of the group forum for individual topics. Thant can’t be good.
This doesn’t seem to be working for me. Is it still a good fix for everyone else? The setting for title, meta description, open graph, etc. from Yoast settings are still bbeing ignored and the metas are not being outputted in the source.
Where do I put this code @mairaj?
I just implemented this approach.
I’m still reviewing the impact but so far so good I guess. Took out the part referencing buddyblog since I’m not using that plugin.
- You must be logged in to reply to this topic.