Two days ago, we published an awesome article about using Genesis Framework shortcode to customize Genesis child themes. On of the difficulties we had was preventing the shortcode from being executed when we include it in the body of the post. Since we’re using Genesis Framework, any Genesis shortcode that we put in the body of the post will be executed. Therefore, we need to find a way to prevent any shortcode from being executed in the body of a post.
Luckily, the solution to this is dead simple. If you open
wp-includes/shortcodes.php file, you’ll find this chunk of code:
The code above was copied from line 191 t0 247 from the file (as of WordPress 3.8.1).
If you’ve no idea what the code is doing, freat not. WordPress does everything for you. In line 11 and 16, you’ll see these comments:
An extra [ to allow for escaping shortcodes with double []
An extra ] to allow for escaping shortcodes with double []
There’s no additional code or plugin need to be added to your site.
Whenever you want to post a shortcode and do not want it to be executed, simply wrap it with with double [ and ]. From example,
That’s all you need to do. We hope this tutorial helped you out. This is a very basic thing you need to know, especially when you publish many WordPress tutorials like us.