Websupporter

Just another Websupporter site

Stop Shortcode from being executed

For some of my Plugins, I use a WordPress page to explain how they work. Of course, on this page, I also activate the plugin to show, what this plugin can do.

But this means some trouble. Once, you want to explain the shortcode and you write the shortcode – well, the shortcode gets executed of course. So sometimes, it would be very useful to stop shortcodes from being executed.

So, I’ve developed another shortcode, which prevents shortcodes to get executed: [stop_shortcode].

How does it work? Lets say, I write an article, in which I explain the usage of a shortcode:

You have to use the plugins shortcode [stop_shortcode][this_shortcode_wont_be_executed][/stop_shortcode]

All you need are these four lines of code:

	add_shortcode( 'stop_shortcode', 'stop_shortcode' );
	function stop_shortcode( $attr, $content ){
		return $content;
	}

Add them to your functions.php and you are done.

About the author

Seine erste Webseite hat David Remer 1998 in HTML verfasst. Wenig später war er fasziniert von DHTML und JavaScript. Nach jahrelanger Freelancerei arbeitete er zunächst für Inpsyde und ist heute Entwickler bei Automattic. Außerdem hat er das Buch "WordPress für Entwickler" verfasst.

Leave a Reply

Your email address will not be published.