Shortcode in Menus


Allows you to add shortcodes in WordPress Navigation Menus so that you can generate links dynamically. Also allows you to add full fledged HTML sections to navigation menus.


See the screenshots.

Also, see a great tutorial by Aurovrata Venet

Special Thanks To


  • Check the screen options, if you don't see the Shortcode box.
  • Check the Shortcode option to see the new Shortcode box.
  • Add your shortcode/HTML to the text area (not a link, in the screenshot). Optionally, add a title.
  • The menu item is saved.
  • The html is displayed.
  • Old Method: In the Links box, add your shortcode in the URL field.
  • Old Method: If you want to use a shortcode that outputs not just the URL, but complete HTML sections, write FULL HTML OUTPUT in the Link Text option for that link and it will output the complete HTML without breaking your site.
  • Old Method: The menu item is saved.


  1. Add the plugin’s folder in the WordPress’ plugin directory.
  2. Activate the plugin.
  3. You can now add ShortCodes in the custom links of the menus.
  4. To test this, you can add a custom link with a ShortCode [gs_test_shortcode] as link, if it points to, plugin is working
  5. If you want to use a ShortCode that outputs not just the url, but complete HTML sections, please make use of the title ‘FULL HTML OUTPUT’ for that link and it will output the complete HTML without breaking your site.


How to enter shortcode

You can add enter shortcodes in the «Custom Link» menu item, or you can use «Shortcode» menu shortcodes in menus.

Screencast for using WordPress’ default «Custom Links» menu item:

Screencast for using «Shortcode» menu item:

How to view/edit «Shortcode» menu item

You will need to enable displaying of «Description» in order to view/edit «Shortcode» menu item.

Here’s a screencast for the same:


30. november, 2021
I needed a value in an ACF options field to serve as the link for a menu item and also a button in a custom block. Just a few minutes after starting my search, I had the plugin installed, a simple shortcode added to my functions file, and it's ready to go!
30. august, 2021
I tested and it works fine as far as the what it says but the downside is that it may not be compatible with wordpress 5.8 as yet as it definitely is causing the layout on my page to break . I use the Divi theme and builder. As soon as i deactivate this plugin everything becomes alright again. It's just because of this that i will not use it now.
23. juli, 2021
Świetny plugin. Robi, co ma robić, nie generuje problemów.
14. mars, 2021
thank you for the work on this awesome plugin! may the force be with you 🙂
18. februar, 2021
works well, simple, useful.
Les alle 72 vurderinger

Bidragsytere og utviklere

“Shortcode in Menus” er programvare med åpen kildekode. Følgende personer har bidratt til denne utvidelsen.




  • Change plugin constants to follow naming conventions as recommended by WordPress Guidelines.
  • Strict input filters for admin pages, for user input values.
  • Adhere to more strict PHPCS ruleset.


  • Resolved some WPCS compatibility issues.
  • Added resource version for static resources for busting cache in new releases.
  • Added text domain to localisable text strings.
  • Loading the custom JS in footer instead of header for performance benefit.
  • Handle PHP notice in custom cases when start_el is not passed with $item object.


  • Escaping of output within a lot of functions.
  • Made the code WordPress PHPCS Compatible.
  • Patch to make it work with Max Mega Menu plugin.


  • Fixed a compatibility issue with Twenty Fifteen theme.
  • Minified JS.
  • Conditional loading of admin class for performance improvement.
  • Some more code refactoring.
  • Testing with WordPress 4.8.1
  • Changed minimum required WordPress version from 3.5 to 3.6


  • Code Refactoring.
  • Changed tested upto.
  • Corrected links in description.


  • Fixed the bug with clean_url filters as reported by Lee Willis
  • Made the code translation ready.


  • Removed the error trigger on the FULL HTML OUTPUT usage.
  • Added the feature to use shortcodes in titles of menu items as well(works with all types of menu items).
  • Resolved the PHP Notice, popping up in the error log while adding new shortcodes.


  • Bug fix for custom links with ShortCode like structure not being displayed in the nav menus.


  • Added new Shortcode box to Menu Editor.
  • Added html support.
  • Deprecated Links box basis.
  • Added screenshots.
  • Updated readme and instructions.


  • Added ability to echo complete HTML output instead of just URL by using ShortCode.


  • Tested with WordPress 4.0


  • Added prefix to function which was conflicting with another plugin.


  • Initial Plugin uploaded.