How to Quote a Shortcode in WordPress

less than 1 minute read

Wordpress offers a handy mechanism called a “shortcode”, which is a kind of macro. Shortcodes are supplied by Wordpress itself and by plugins that extend Wordpress’ functionality.

You use a shortcode by simply writing it in your post or page enclosed in square brackets, ie:


When you’re writing a post about a shortcode in a plugin you’ve written and are using in your web site, you’ll run into a problem where you will want to show examples of the use of the shortcode, but the examples trigger it.

You can quote the shortcode by doubling up on the opening and closing square brackets, ie:


I didn’t know this and didn’t need it until recently and was agonizing about it until I found how to do it.