Title: Shortcode in Menus
Author: Gagan Deep Singh
Published: <strong>2013 年 9 月 13 日</strong>
Last modified: 2026 年 2 月 10 日

---

搜索插件

![](https://ps.w.org/shortcode-in-menus/assets/banner-772x250.png?rev=1016802)

![](https://ps.w.org/shortcode-in-menus/assets/icon-128x128.png?rev=1016813)

# Shortcode in Menus

 作者：[Gagan Deep Singh](https://profiles.wordpress.org/gagan0123/)

[下载](https://downloads.wordpress.org/plugin/shortcode-in-menus.3.5.1.zip)

 * [详情](https://cn.wordpress.org/plugins/shortcode-in-menus/#description)
 * [评价](https://cn.wordpress.org/plugins/shortcode-in-menus/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/shortcode-in-menus/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/shortcode-in-menus/#developers)

 [支持](https://wordpress.org/support/plugin/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.

**Usage**

See the [screenshots](https://cn.wordpress.org/plugins/shortcode-in-menus/?output_format=md#screenshots).

Also, see a [great tutorial](https://wordpress.org/support/topic/how-does-it-work-24/page/2/#post-4987738)
by Aurovrata Venet

**Special Thanks To**

 * [Aurovrata Venet](https://wordpress.org/support/profile/aurovrata) for [this great tutorial](https://wordpress.org/support/topic/how-does-it-work-24/page/2/#post-4987738).
 * [Lee Willis](https://wordpress.org/support/profile/leewillis77) for finding out
   and helping in resolving [this bug](https://wordpress.org/support/topic/causes-urls-to-be-amended-in-undesired-ways).
 * [Dennis Hunink](https://wordpress.org/support/users/dhunink/) for reporting [this bug](https://wordpress.org/support/?p=10325305).
 * [@hbwarper](https://wordpress.org/support/users/hbwarper/) for providing a patch
   to Dennis’ issue.

## 屏幕截图

[⌊Check the screen options, if you don't see the Shortcode box.⌉⌊Check the screen
options, if you don't see the Shortcode box.⌉[

Check the screen options, if you don’t see the _Shortcode_ box.

[⌊Check the Shortcode option to see the new Shortcode box.⌉⌊Check the Shortcode 
option to see the new 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.⌉⌊Add your shortcode/HTML to the text area (not a link, in the screenshot).
Optionally, add a title.⌉[

Add your shortcode/HTML to the text area (not a link, in the screenshot). Optionally,
add a title.

[⌊The menu item is saved.⌉⌊The menu item is saved.⌉[

The menu item is saved.

[⌊The html is displayed.⌉⌊The html is displayed.⌉[

The html is displayed.

[⌊Old Method: In the Links box, add your shortcode in the URL field.⌉⌊Old Method:
In the Links box, add your shortcode in the URL field.⌉[

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:
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: 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.⌉⌊Old Method: The menu item is saved.⌉[

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 https://wordpress.org, 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:

## 评价

![](https://secure.gravatar.com/avatar/2a3375dfa51746fb4ac9decdd101d93e8148b554ee06d3b0bace1efee42668b2?
s=60&d=retro&r=g)

### 󠀁[‘Please provide a valid link.’](https://wordpress.org/support/topic/please-provide-a-valid-link/)󠁿

 [andrebell82](https://profiles.wordpress.org/andrebell82/) 2026 年 3 月 10 日

Interesting concept but adding the shortcode to the link as the images show generates
a wordpress error: ‘Please provide a valid link.’ So, unfortunately, cannot add 
the shortcode to nav bar as the example images show 🙁

![](https://secure.gravatar.com/avatar/ec147139c32dab1fc287160c663450e1aed03e9e1293fc72f60b808479a56f26?
s=60&d=retro&r=g)

### 󠀁[Please don’t let this plugin die..](https://wordpress.org/support/topic/please-dont-let-this-plugin-die/)󠁿

 [Namaste](https://profiles.wordpress.org/victoryel/) 2024 年 3 月 12 日

I kindly ask the developers to maintain this plugin updated… please 🙂

![](https://secure.gravatar.com/avatar/0f284254efd1d885741b5514ba8f5f3eea4ac2ca353ad45d2dcf7c6dd7ad7eb8?
s=60&d=retro&r=g)

### 󠀁[Didn’t work for me](https://wordpress.org/support/topic/didnt-work-for-me-195/)󠁿

 [madbirdesign](https://profiles.wordpress.org/madbirdesign2/) 2023 年 12 月 11 
日

Didn’t work in shortcode menu item or custom link.

![](https://secure.gravatar.com/avatar/4d9ff8ac325fdc9f8fa842ed8aefd0a119fe0feecfe8e5fb850d39c5b0c09778?
s=60&d=retro&r=g)

### 󠀁[Didn’t work for me….](https://wordpress.org/support/topic/didnt-work-for-me-194/)󠁿

 [pebworthbells](https://profiles.wordpress.org/pebworthbells/) 2023 年 9 月 15 
日 1 回复

The plugin seemed fine and I used it to create custom menu items for my websites
headers and footers. v\Very happy with the results until complaints came in that
blocks of buttons had stopped working on some pages. On investigation, I found that
blocks of 4 or 5 buttons in adjacent columns were not working. The outer buttons
worked fine, but any inner button (i.e. it had another button in the columns either
side of it) would work once and then stop responding until the page was reloaded.
In addition some page sections became unselectable to edit in Elementor. Very quickly
it became apparent that this problem was universal to all blocks on all pages! I
disabled the plugin and everything came back to work fine! luckily, it was the only
change I had made in recent days, so the likely culprit was relatively obvious. 
I am guessing there is a compatibility issue with current version of Elementor.

![](https://secure.gravatar.com/avatar/871ff341cfa2d0153a8c305af34a5e9ec6f6cf800530cc5d8e493593bcbfbe85?
s=60&d=retro&r=g)

### 󠀁[Thank you!](https://wordpress.org/support/topic/thank-you-3409/)󠁿

 [schroederskater](https://profiles.wordpress.org/schroederskater/) 2023 年 8 月
5 日

Easy to use. Does what it is supposed to. Great! Than you very much! Thomas

![](https://secure.gravatar.com/avatar/f33236201e55e772441f2ff66b53b7796e09dca8cfa5689a4a249aee3418b656?
s=60&d=retro&r=g)

### 󠀁[The perfect shortcode in menu plugin!](https://wordpress.org/support/topic/the-perfect-shortcode-in-menu-plugin/)󠁿

 [basbuis](https://profiles.wordpress.org/basbuis/) 2023 年 2 月 10 日

Thanks, it’s working perfect and fast.

 [ 阅读所有82条评价 ](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/)

## 贡献者及开发者

「Shortcode in Menus」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Gagan Deep Singh ](https://profiles.wordpress.org/gagan0123/)
 *   [ Saurabh ](https://profiles.wordpress.org/saurabhshukla/)

[帮助将「Shortcode in Menus」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/shortcode-in-menus)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/shortcode-in-menus/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/shortcode-in-menus/)，或通过[RSS](https://plugins.trac.wordpress.org/log/shortcode-in-menus/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/shortcode-in-menus/)。

## 更新日志

#### 3.5.1

 * 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.

#### 3.5

 * 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.

#### 3.4

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

#### 3.3

 * 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

#### 3.2

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

#### 3.1

 * Fixed [the bug](https://wordpress.org/support/topic/causes-urls-to-be-amended-in-undesired-ways)
   with clean_url filters as reported by [Lee Willis](https://wordpress.org/support/profile/leewillis77)
 * Made the code translation ready.

#### 3.0

 * 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.

#### 2.1

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

#### 2.0

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

#### 1.2

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

#### 1.1

 * Tested with WordPress 4.0

#### 1.0

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

#### 0.1

 * Initial Plugin uploaded.

## 额外信息

 *  版本 **3.5.1**
 *  最后更新：**4 月前**
 *  活跃安装数量 **50,000+**
 *  WordPress 版本 ** 3.6 或更高版本 **
 *  已测试的最高版本为 **6.9.4**
 *  PHP 版本 ** 5.6 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/shortcode-in-menus/)
 * 标签
 * [custom link](https://cn.wordpress.org/plugins/tags/custom-link/)[menus](https://cn.wordpress.org/plugins/tags/menus/)
   [shortcode](https://cn.wordpress.org/plugins/tags/shortcode/)
 *  [高级视图](https://cn.wordpress.org/plugins/shortcode-in-menus/advanced/)

## 评级

 4.7 星（最高 5 星）。

 *  [  74 条 5 星评价     ](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/?filter=5)
 *  [  2 条 4 星评价     ](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/?filter=3)
 *  [  1 条 2 星评价     ](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/?filter=2)
 *  [  5 条 1 星评价     ](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/shortcode-in-menus/reviews/)

## 贡献者

 *   [ Gagan Deep Singh ](https://profiles.wordpress.org/gagan0123/)
 *   [ Saurabh ](https://profiles.wordpress.org/saurabhshukla/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/shortcode-in-menus/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](https://PayPal.me/gagan0123)