Introduction
BuddyBoss does not provide a built-in option to customize Yoast SEO meta descriptions for individual member profile pages. However, you can use a small custom function to dynamically generate meta descriptions from a member’s profile fields (e.g., Bio field). This guide explains how to add custom Yoast SEO meta data for a member’s profile page.
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- Add a new profile field named Bio in your BuddyBoss member profiles.
Learn how here: Profile Fields Documentation - Go to Appearance > Theme Editor in your WordPress admin dashboard.
- Under Select theme to edit, choose your active theme (preferably BuddyBoss Child Theme), then click Select.
- From the Theme Files list, open Theme Functions (functions.php).
- Add the following code just before the closing PHP tag (?>):
<?php
// Create the members page's meta description using the Bio profile field
add_filter( 'wpseo_metadesc', 'bb_custom_metadata_member_page' );
function bb_custom_metadata_member_page( $desc ) {
// Exclude blog pages and directories
if ( bp_is_blog_page() || bp_is_directory() ) {
return $desc;
}
// Only modify for user profile pages
if ( bp_is_user() ) {
$args = array(
'field' => 'Bio', // Name of the profile field
);
$bio = bp_get_profile_field_data( $args );
if ( empty( $bio ) ) {
$bio = "Some default description. Please fill your Bio in Profiles → Edit → Bio.";
}
// Format meta description: "John Doe - Bio text"
$desc = sprintf( '%s - %s', bp_get_displayed_user_fullname(), $bio );
}
return $desc;
}
?>- Click Update File to save the changes.
Troubleshooting and FAQs
Q: The meta description is not updating on member pages.
A: Ensure the code is added to your child theme’s functions.php file. Also, clear any caching or SEO plugin caches.
Q: Can I use other profile fields instead of Bio?
A: Yes. Replace ‘Bio’ in the $args array with the name of any custom profile field.
Q: Will this affect other pages?
A: No. This only modifies meta descriptions on individual member profile pages.
Q: Can I revert this change easily?
A: Yes. Remove or comment out the code from functions.php and save the file.