{"id":1115,"date":"2011-07-15T19:10:31","date_gmt":"2011-07-15T17:10:31","guid":{"rendered":"http:\/\/raftaman.net\/?p=1115"},"modified":"2021-05-15T11:46:39","modified_gmt":"2021-05-15T09:46:39","slug":"escaping-wordpress-shortcodes","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=1115","title":{"rendered":"Escaping WordPress shortcodes"},"content":{"rendered":"<p>With WordPress 2.5 came the <a href=\"http:\/\/codex.wordpress.org\/Shortcode_API\">WordPress shortcodes<\/a>, 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.<\/p>\n<p>However, those plugins are actually obsolete. The <a href=\"http:\/\/core.trac.wordpress.org\/ticket\/6518\">issue<\/a> 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.<br \/>\nSimply <strong>double the square brackets<\/strong> to allow any shortcode in your post escape the parsing:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n    &#x5B;&#x5B;shortcode]]\r\n<\/pre>\n<p>will be displayed as [shortcode] in your post.<\/p>\n<p>Optional <strong>parameters<\/strong> to the shortcode are of course still possible, i.e. <\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n    &#x5B;&#x5B;&#x5B;gallery link=&quot;file&quot; columns=&quot;2&quot;]]]\r\n<\/pre>\n<p> will be displayed as [gallery link=\"file\" columns=\"2\"]<\/p>\n<p>Resources:<br \/>\n<a href=\"http:\/\/www.wordpresspluginfu.com\/2010\/04\/escaping-shortcodes-in-wordpress\/\">http:\/\/www.wordpresspluginfu.com\/2010\/04\/escaping-shortcodes-in-wordpress\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=1115\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-1115","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1115"}],"version-history":[{"count":15,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1115\/revisions"}],"predecessor-version":[{"id":2673,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1115\/revisions\/2673"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}