Stop WordPress From Rendering a Shortcode in Posts

When you put a shortcode in the post editor, WordPress will render the shortcode and show the ouput on the post page.

But what if you want to show the shortcode itself on the post page instead of the output?

And why would you want to do that?

Let’s say you are writing a tutorial post where you are writing about a shortcode – [some_shortcode]. Now you want to show how to use that shortcode to your users.

But if it gets rendered users can’t see the shortcode.

So you would need to show [some_shortcode] in the post instead of the output it renders.

How To Stop WordPress From Rendering a Shortcode

How to do that? It’s very easy.

Just put another square bracket around the shortcode. Like this – [[some_shortcode]]

Now WordPress will not render the shortcode. Instead it will show [some_shortcode] in your posts.

Simple as that.

I have a shortcode plugin which shows the current date when you put the shortcode in your posts.

Here’s how it works. Today’s date: 22nd March 2018

Now, let’s show you the shortcode for this – [current_date]

It shows the shortcode instead of the output date, because I have put extra square brackets around it.

That’s it.

If you found this trick useful, don’t forget to share it with others. If you have any questions, ask them through comments.

Leave a Reply

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