WordPress shortcodes are an easy way to embed dynamic content in WordPress posts. But sometimes I want to write about using shortcodes. To display the verbatim shortcode text in a post, without having WordPress parse it, it must be escaped.
Escaping a shortcode is easy. Just double the enclosing square brackets.
For instance, to display [gallery] in a post, write [[gallery]].
For short codes with start and end tags, only double the first and last brackets: [[shortcode]...[/shortcode]].
It worths noting that currently the escaping will occur only if the shortcode is active. Escaping a disabled shortcode will result a doubling brackets in the output: [[fakeshortcode]] remains [[fakeshortcode]]…
This is true for WordPress 4.0, but is recognized as a bug. So if it’s fixed sometime in the future, and the above example contains a single bracket – let me know in the comments so I can fix this 🙂 .



