How to Prevent Shortcode from Working?


Hello Friends. I wish you have a nice day. :smile:

Today, I have created my own shortcode plugin Google+ Badge Shortcode for Blogger but now, I have a problem. When I was going to give example code of shortcode, I was unable to give it because it got changed into Google+ Badge. So I putted images in which I have written example.

My question is, how can I prevent a line of shortcode to get changed?



how about using html escape tool.

(ignore this text, just so i can post lol)


But according to HTML, ‘[’ or ‘]’ is not a character of HTML that’s why @Mohammad used it in Shortcodes plugin. :frowning:


okay i just got it lol. wrap your shortcode.js in a conditional tag for url. eg:

<b:if cond='data:blog.url != "http://your_url_to_prevent_script_from_running"'><script src='http://yourscriptdomain/shortcodes.js type='text/javascript'/></b:if>


See, like I have installed Facebook Page Plugin shortcode on my blog, how to prevent [facebook src=‘bloggertricks’/] from getting changed into facebook page plugin?


yep like i said, just specify which page or URL the script will not run. i’ve already gave an example. you’ll not know until you tried it.


Yeah! I got it. Thanks :smiley:



But @Chelyz_Marx, what if I want to stop it from displaying in some more pages? Because I am thinking to create some more shortcodes. So how?


The simplest solution is to keep the shortcode variable you use inside your template different from what you share with your readers on your tutorial. For example for the image shortcode that we published on MBT. We are using [img] shortcode variable inside the mbt template but for readers we created a different script with variable [image]

This is the only way to share shortcodes in their original syntax with your readers.


Thanks Mohammad. Now, I can share it without any hassle.