Escaping WordPress shortcodes

      No Comments on Escaping WordPress shortcodes

With WordPress 2.5 came the WordPress shortcodes, a simple set of functions to create macros to be used in WordPress posts. Quite a few plugins were developed subsequently to enable escaping of those shortcodes. This is necessary because the shortcode parser, as it tries to interprete everything between square brackets, makes it impossible to include a non-interpreted shortcode such as [gallery] into continuous text.

However, those plugins are actually obsolete. The issue has been fixed with the release of WordPress 2.8. Now there is an official syntax that allows you to escape shortcodes in your posts without the need for any additional pluging.
Simply double the square brackets to allow any shortcode in your post escape the parsing:


will be displayed as [shortcode] in your post.

Optional parameters to the shortcode are of course still possible, i.e.

    [[[gallery link="file" columns="2"]]]

will be displayed as [gallery link="file" columns="2"]


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.