Here’s one way to do it with the help of the menu CSS classes:
For the menu item that you want to modify the label of, add the wpse_menu
class to it:
This is supported with:
/**
* Modify the title of menu items that contain the 'wpse_menu' class.
* We restrict this to the primary menu.
*/
add_filter( 'wp_nav_menu_objects', function( $items, $args )
{
if( isset( $args->theme_location ) && 'primary' === $args->theme_location )
{
foreach( $items as &$item )
{
if( in_array( 'wpse_menu', $item->classes ) )
$item->title = __( ' Related ' ) . $item->title . __( ' products ' );
}
}
return $items;
}, 10, 2 );