Skip to:
Content
Pages
Categories
Search
Top
Bottom

Name shows in browser tab

  • @kir-2012

    Participant

    Hi – apologies if this is a really obvious one but I don’t seem to be able to find a way to do it.

    On my buddypress profiles, I’m using usernames and the mention names. I don’t want real names to appear anywhere and it appears in the browser tab, is there a way to change it? I found this but it doesn’t seem to work for me, any suggestions gratefully receieved? Thanks 🙂

    // Change User Profile Browser Page Title.
    function yz_change_buddypress_browser_tab_title( $bp_title_parts ) {
         
        if ( bp_is_user() ) {
        	return "XXXX";    
        }
    
        return $bp_title_parts;
     
    }
     
    add_filter( 'bp_get_title_parts', 'yz_change_buddypress_browser_tab_title', 999 );
Viewing 3 replies - 1 through 3 (of 3 total)
  • @emaralive

    Moderator

    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.

    @kir-2012

    Participant

    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

    @emaralive

    Moderator

    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 );
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar