1

Suppose, I have a plugin which is offering a shortcode for its users: [my-shortcode]. Now I want to post an advertisement in a page of my WordPress powered blog like the following:

Hey you can use the plugin using the [my-shortcode] into any page/post.

If I write so, on the front end WordPress thinks it's a shortcode, it tries executing this, and showing an ugly white blank block there. So I switched to the HTML mode of the editor, and wrap the text like this:

<code>[my-shortcode]</code>

Without switching back to the visual editor if I update the page, and see the front end, it's working just fine. But if now I need the visual editor for further editing [visually], and switch back to the visual editor again TinyMCE can't understand that it's a simple text, not a shortcode, and the same massacre happens again. :(

Even if I want to write something, anything with a third bracket like:

Do something [once] and go...

WordPress can't understand it's a simple text. :(

How can I handle situation like this?

1 Answer 1

1

Use a double third brackets then. In visual editor:

[[my-shortcode]]

To show shortcode as a code, in HTML/Text mode:

<code>[[my-shortcode]]</code>

And you can even write anything with a third bracket in this way:

Do something [[once]] and go...

*suggested by SergeyBiryukov

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.