Escape code does not works
-
Not sure if this is Shortcoder problem or WordPress problem, but since it broke after I upgraded shortcoder.
I am currently unable do escape, i.e. [[sc name=”…”]] in my code. It just display [ and the shortcode content. This kinda broke our internal page that guide our author how to use such shortcode.
-
hmm.. do you mean you want to display the shortcode syntax as is without executing ?
Any screenshots to explain will be better.
I have content like this (sorry it’s not in English): https://imgur.com/9zQ3jIg (Picture from WP’s TinyMCE editor)
for escaping shortcode seems to be WordPress standard so I am not sure if it’s WordPress problem or Shortcover V5 problem. But previously, when I type [[sc name=”XXX”]] like in the pictured, it would get displayed as [sc name=”XXX] without the shortcode executing.
I seems to have narrowed down the problem. This problem (escaping with does not work) only occurs when there are shortcode with enclosed contents that come after the escaped shortcodes. Sorry, I am not really sure if this is wordpress or shortcoder bugs. It may have existed before V5 as well.
-
This reply was modified 6 years, 3 months ago by
innocenat.
Ok, so if you want to display the shortcode as is without executing then the proper way would be use like below and not double square brackets AFAIK.
[sc name="your-shortcode-name" ]Using
[would print[as is.You should put that somewhere in your documentation then. Most of the google result for escaping WordPress shortcode will suggest double bracket (it’s included in WP Core since version 2.5: https://core.trac.wordpress.org/ticket/6518)
I guess I will see if I could modify the plugin. I have way too many pages written with double bracket.
Thank you.
-
This reply was modified 6 years, 3 months ago by
innocenat.
hmm… It can be documented. But I don’t see any reason why any normal user should print the shortcode syntax as is without executing.
I guess you had a reason. But this is not something related to shortcoder. Any shortcode you want to print as is, you have to escape the character to its respective HTML entity as in the table. https://www.freeformatter.com/html-entities.html
Cheers !
Thanks,
AakashWhile I understand that it might be a hassle to support, it is related in a sense that double bracket escape is the standard way of escaping shortcode in WordPress. And it works fine with shortcoder too if no enclosed content shortcode is used.
As for why normal user would do, as I said in my other comment, it is used in in contributor guideline telling website contributors how to use various shortcode to format their posts.
I assume that the enclosed content feature uses custom shortcode parser and that might be hard to fix, and I respect that.
-
This reply was modified 6 years, 3 months ago by
innocenat.
I understand your scenario. Anyways I’m not sure if the ticket you pointed is still relevant. I simply use the one I told in my shortcoder documenation like in this discussion https://wordpress.stackexchange.com/questions/33960/how-do-i-escape-a-in-a-short-code
It is not as easy to write as double square brackets but will and always work.
Thanks,
AakashThat doesn’t really work when you have contributor that doesn’t really want to touch the code tab.
I guess I will just not use shortcode with enclosed content, and split into begin and end shortcode instead.
EDIT: Sorry, didn’t realised it works in visual mode too.
-
This reply was modified 6 years, 3 months ago by
innocenat.
@innocenat, Yeah anyways it is not something related to shortcodes from Shortcoder. It applies to any shortcode in WordPress.
Glad that you found a way.
Cheers !Argh. You will always deny responsibility aren’t you? I am not looking for the fix, but you can’t deny that it is related because it works for all WordPress shortcode EXCEPT in the situation explained above. Having other ways to accomplish the same thing doesn’t mean that another way isn’t valid.
You are probably going to brush it aside again anyway.
Can you please share me an example where the standard way of double escaping does not work because of enclosed content ?
Because in the example screenshot you shared I didn’t find any enclosed shortcode i.e
[/sc]Did you try something like this ?
[[sc name="parent" ]]Some content [[/sc]] -
This reply was modified 6 years, 3 months ago by
The topic ‘Escape code does not works’ is closed to new replies.