Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've looked and have not found anything that works.

I am trying to include a shortcode in a menu item's 'Navigation Label'. Basically Iwould like to have a dynamic title displaying the user's name & avatar.

[profilepicture round] [user_name]

Right now it's just spit back out since Wordpress Menus do not parse shortcodes. I've tried:

function my_nav_menu_objects_shortcode_mangler($items) {
    foreach ($items as $item) {
       $item->title = do_shortcode($item->title);
    return $items;

But it doesn't parse it. I also tried $item->type_label with no luck. Am I just referencing the wrong attribute of item?

Also tried the following with no luck.

 add_filter('wp_nav_menu_items', 'do_shortcode');

The avatar and username can both be retrieved via php if needed:

<?php echo userpro_profile_data('user_login', $user_id); ?>
<?php echo userpro_profile_data('profilepicture', $user_id); ?>
share|improve this question
This could be theme specific if your theme uses a custom nav menu walker. Can you confirm whether it uses the default WP nav menu walker? – cfx Jul 6 '14 at 8:02
Also, what kind of menu item is it (link? page? post? other?) and where are you entering the shortcode (as the nav label? title? other?)? – cfx Jul 6 '14 at 8:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.