Skimming through the core file, there are some quick & dirty ways available (untested):
-
! is_admin() && add_filter( 'wp_nav_menu_items', 'do_shortcode' );
-
! is_admin() && add_filter( 'the_title', 'do_shortcode' );
-
! is_admin() && add_filter( 'walker_nav_menu_start_el', 'do_shortcode' );
But I would rather target the menu labels directly with for example (untested):
/**
* Support shortcodes in the menu labels
*/
! is_admin() && add_action( 'nav_menu_link_attributes', 'wpse_shortcode_in_menu' );
function wpse_shortcode_in_menu( $atts )
{
add_filter( 'the_title', 'wpse_do_shortcode' );
return $atts;
}
function wpse_do_shortcode( $content )
{
remove_filter( current_filter(), __FUNCTION__ );
return do_shortcode( $content );
}
Related Posts:
- Using Shortcodes in WP-Menus in WP 3.1 (via nav_menu_objects)?
- Navigation (wp_nav_menu) refuses to nest within parent element
- Using a shortcode to create a dropdown menu from wp_nav_menu list items
- Can you add shortcode as a menu item link?
- use value returned from shortcode as menu item
- Prevent Menu Shortcode From Formatting
- Primary menu shortcode name
- Hiding Widget On Mobile Devices Removes Our Product Search Box On Mobiles
- wp_nav_menu: show menu only if one exists, otherwise show nothing
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Making breadcrumb with wp_nav_menu
- Renaming a WordPress Admin Menu
- Deleted pages are NOT removed from custom menus?
- How to add active class on current menu item page?
- Add Page ID class to nav menu items
- WordPress nav_menu_link_attributes Not Working
- menu entries are lost
- Nav Menu and display post count
- Automatically Add New Tags to Sub-menu
- Accesibility problems with dropdown menus in twentyten theme or others
- Error “The given object ID is not that of a menu item” on menu with 40+ items
- TwentyTwelve child theme mobile menu not working
- Theme menu in Admin Panel
- How to target children of child pages
- Adding post excerpt into navigation menu
- Editing WordPress Nav Menu Walker
- Convert WP Menu to a Drop Down for Mobile browser
- WordPress Admin Bar Covering & Overlapping Fixed Menu Header [closed]
- Prepend to start of WordPress nav loop
- Change search results order for Admin -> Appearance -> Menus -> Pages -> View all
- Add custom external link to menu
- How I can overlap my menu in my header picture
- current-menu-item class in CSS
- How to make the Primary Menu stay the same in the PC and mobile versions of the Twenty Sixteen theme
- How to add notifcations to front-end menu for users when they recieved replies?
- Page content loading issue using Walker_Nav_Menu
- Changing status of Published posts which have less Content to “Draft”
- Main menu highlighting on subpage which is not in submenu but in hierarchy
- Using Zurb’s Foundation Tabs as WordPress Nav (Active Tab)
- Links do not open from click, only in new tab [closed]
- Create menu without admin panel
- a better menu, menu options assistance for WP
- Add a custom class to nav li item
- Adding anchors in WordPress Menus
- Can’t display custom menu using name?
- Adding a unique ID to each sub-menu
- How to add css to single navigation text? [closed]
- how to add data to li for wp_nav_menu?
- How to change the link on the logo at the menu?
- Convert complex HTML menu to WordPress [closed]
- add page to main menu (frontend)
- Creating Menu Links in a Custom Theme
- My navigation menu isn’t working. What happened? Please help!
- Nav menu classes ‘has-dropdown’ but no ‘active’
- Add third level menu on wordpress
- How to list menu-item- ids in order for wp_nav_menu
- How to show pages in menu without link
- Drop down menus with wp_nav_menu or wp_page_menu
- Show wp_nav_menu() based on URL with no fallback
- How to display conditional menus with Twenty-twenty two theme (and other new block themes)?
- I’m trying to remove a duplicate menu, which only appears on the homepage?
- Embedding an external webpage within a page? Is it possible, is it a good idea?
- Add prefix to url, but products not showing in page SHOP
- Create link/button to create new post using specific template
- How to use Bootstrap Navbar in wordpress Nav Menu
- wp_nav_menu seems to be printing the wrong menu
- WP Menu editor is hiding options for menu items
- Appearance -> Menu editor completely unresponsive
- javascript i wrote not working, can’t figure out why [closed]
- Classes CSS (Optional) – how do I reference this in php?
- Replacing nav-menus.php file with standard clean one?
- How to add limited items in WordPress menu?
- how to create pages and link them to a menu
- Outputting Page Title As Tooltip
- Creating custom Menu for custom theme
- Menu subitem doesn’t keep its position
- Installing compact search in the main menu?
- Next/previous a-like single navigation
- How to create a menu super voice in WP?
- Menu administration, how to allow special charachters
- How to avoid website url appending problem in wp site?
- Create custom page and custom menu
- Get first menu item of custom menu
- Bought custom navigation menu from codecanyon, how to change feature.php?
- Custom menu linking to page not found
- How to insert date in topNav
- Somehow lost my MENU from my home page- help!
- How to completely remove the top section with the menu?
- Customizing Responsive Themes Menu [closed]
- How To Conditionally Change Menu In Same Theme Location
- How to display a submenu as a popup when clicking a button?
- Add menu to CMS page
- Not even able to Log in [closed]
- how can i get the page_ID in nav li [closed]
- How do i add logo in wordpress studiopress (glam theme)?
- What is the best way to incorporate responsive dropdown navigation menu into custom theme?
- how to add permalink/slug to wordpress custom link menu item
- Submenu items not working anymore
- Icon not shown in Dropdown menus in Twenty Seventeen Theme
- How to change WP menu item type?