To change the “Follow Me” button text in BuddyPress, you can use the bp_get_add_follow_button
filter. This filter allows you to modify the HTML output of the follow button.
Here’s an example of how you can use the bp_get_add_follow_button
filter to change the “Follow Me” button text:
// Change the "Follow Me" button text in BuddyPress
// More snippets at wpunplugged.com
/**
* @param string $button The follow button HTML.
* @param array $args The follow button arguments.
* @return string The modified follow button HTML.
*/
function my_bp_custom_follow_button( $button, $args ) {
// Check if the button text is "Follow Me"
if ( 'Follow Me' == $button ) {
// Change the button text to "Follow My Profile"
$button = 'Follow My Profile';
}
return $button;
}
add_filter( 'bp_get_add_follow_button', 'my_bp_custom_follow_button', 10, 2 );
This code will change the “Follow Me” button text to “Follow My Profile” on all of the user’s profile pages. You can modify this code to change the button text to whatever you want.
To add this code to your site, you can add it to your theme’s functions.php
file.
Note that this code assumes that you have the BuddyPress plugin installed and activated on your WordPress site. If you don’t have BuddyPress installed, you will need to install and activate it before you can use the bp_get_add_follow_button
filter.