• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
WPFeed

WPFeed

  • News
  • Tutorials
    • WordPress Multisite
    • BuddyPress
    • Design
  • Reviews
    • Plugins
  • Roundups
  • Snippets
  • Giveaways
Home » How To » How to Prevent WordPress From Executing Shortcode in Post

How to Prevent WordPress From Executing Shortcode in Post

WordPress-shortcode

Two days ago, we published an awesome article about using Genesis Framework shortcodeto 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.phpfile, 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 [[]]

Solution:

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, [[this_is_my_shortcode]].

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.

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

Recent Posts

  • WordPress is a brilliant platform that is loaded with tons of stuff for websites.
  • How to Sync Stock & Price for WooCommerce Products
  • How to migrate a WooCommerce Store to a new site
  • How to Import WooCommerce Products
  • How to export WooCommerce Orders

Copyright © 2023 · WPFeed.com - A Project of TechAbout LLC.

  • About us
  • Advertise
  • Write for us
  • Terms and Conditions
  • Privacy Policy
  • Contact us