How to change the text of link ‘Home’ in bbPress forum breadcrumb?

The string is now in bbpress/includes/common/template-tags.php.

Hook into bbp_no_breadcrumb, register a filter for gettext and change the text:

add_filter( 'bbp_no_breadcrumb', 'wpse_44597_change_home_text' );

function wpse_44597_change_home_text( $translated, $original="", $domain = '' )
{
    if ( 'bbp_no_breadcrumb' === current_filter() )
    {
        add_filter( 'gettext', __FUNCTION__, 10, 3 );
        return FALSE;
    }

    if ( 'Home' === $original && 'bbpress' === $domain )
    {
        remove_filter( current_filter(), __FUNCTION__ );
        return get_bloginfo( 'name' );
    }

    return $translated;
}

The difference to a filter on bbp_get_breadcrumb is: bbp_get_breadcrumb is the complete bread crumb, and it is really hard to find the string for the home page without touching the wrong matches. WordPress might be installed in /www/Home/wp/, or another item might contain the word Home. You do not want to touch that.

Leave a Comment