If you write your own WordPress plugin, you usually set up a new page to document the plugin and how to work with this plugin. If you are using shortcodes, you might run into problems, since you can’t simply write your shortcode into the editor without executing it. I always used an extra script, which I was placing into the functions.php: “Stop shortcode”. This script simply delivered me a shortcode with a single purpose: Not to execute the shortcodes, which are wrapped into it. But today, while reading the regular expressions of the shortcodes (which can be found in wp-includes/shortcodes.php) I found out, you are able to escape shortcodes!
Usually, a shortcode starts with an opening bracket (this sign: [ ) and it ends with a closing bracket (this sign: ] ). But if you use instead [[ to open your shortcode, the shortcode itself won’t be rendered. So [[gallery]] will not render the gallery but output [gallery].
If you want to escape a shortcode with content, you simply write:
Latest posts by David Remer (see all)
- BuddyPress Desktop Notification 0.7 Release - January 14, 2016
- The problem of slug identification in the repository - August 11, 2015
- WordPress Support Ticket - August 10, 2015
This post is also available in: German