From what I can tell, the snippet replaces the text portion of what BuddyPress would normally add to the meta “title” with the text “XXXX” (without the quotes). For example on a members profile view page (site.url/members/username/profile
):
Display name of user: test
Website name: Apple
Without snippet: Profile | test | Apple
With snippet: XXXX | Apple
The snippet (copy & paste) was checked for use in the bp-custom.php file and the functions.php file of a child theme. Perhaps, you could elaborate a bit more as to the steps you took to implement the snippet and what you expected the result to be.
Hi thanks so much for your reply, I have tried the code in both functions and bp custom, I was hoping that it would affect what is shown in the browser tab.
When on the user profile page, although I have changed all other instances to username throughout the site, the ‘full-name’ still appears in the browser tab / when one hovers a browser tab.
For example, if one has a username that’s related to a business, eg ‘TopTableFoods’, it isn’t relevant to see the name of the person who opened the account anywhere on the site, also the business would likely prefer not, so I would like to remove the full-name from appearing in the browser tab and anywhere else. The Activity stream, urls and page titles already use only the username, thanks to the plugin ‘username only’. But I noticed the full name still appears in the browser tab.
Thanks again
The snippet does what it is coded to do, therefore, either the snippet is not being invoked or there is something else (possibly a plugin, theme or other custom code) that is counteracting the snippet.
I’m not familiar with the “username only” plugin, is this plugin available via the WordPress plugins directory? I’m asking because this plugin or some other external factor (a different plugin or theme) might be disrupting the normal flow of events.
The snippet relies on the bp_get_title_parts
filter hook which relies on the bp_modify_page_title()
function to be invoked by the wp_title
filter hook.
You can try hooking the snippet to the wp_title
filter hook to see if that makes any difference, i.e., change:
From:
add_filter( 'bp_get_title_parts', 'yz_change_buddypress_browser_tab_title', 999 );
To:
add_filter( 'wp_title', 'yz_change_buddypress_browser_tab_title', 999 );