This is possible using the filter wpseo_breadcrumb_links
.
In this example, I’m using the functions bp_get_user_meta
and bp_loggedin_user_id
, adjust as needed.
To check if the page is child of the Members page (in this example, ID == 2
), I’m using the function has_parent
grabbed from here.
add_filter( 'wpseo_breadcrumb_links', 'buddy_crumbs_wpse_88889' );
function buddy_crumbs_wpse_88889( $links )
{
// apply only in childs of Members page
// in this example, Members has the ID of 2
global $post;
if( !has_parent_wpse_88889( $post, 2 ) )
return $links;
$user_info = bp_get_user_meta( bp_loggedin_user_id(), 'nickname', true );
$links[] = array( 'url' => '', 'text' => $user_info );
return $links;
}
function has_parent_wpse_88889($post, $post_id)
{
if ( $post->ID == $post_id )
return true;
else if ( $post->post_parent == 0 )
return false;
else
return has_parent_wpse_88889( get_post( $post->post_parent ), $post_id );
}