Show shortcodes as text without executing them

134 Views Asked by At

Shortcode example: [mytab] my content [/mytab].

But when the plugin is active, it shows the content of shortcode, not show the shortcode as text. I do not want to show the content, I want to show only the shortcode like this. [mytab] my content [/mytab]

1

There are 1 best solutions below

0
On BEST ANSWER

Using the answer from Wordpress Stackexchange:

3 solutions to show your shortcode as text ( not execute it ):

  1. Use second [] for your shortcodes. Such as:

    [[my-shortcode]]
    

    For your case this solution will work so:

    [[mytab] my content [/mytab]]
    
  2. Break the shortcode with some HTML tag, like <span>, <p>, <code>, <div> and etc. Such as:

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

    Your case:

    [<code>mytab</code>] my content [<code>/mytab</code>]
    
  3. Escape [ with &#91; and ] with &#93;:

    &#91;my-shortcode&#93;
    

    Your code:

    &#91;mytab&#93; my content &#91;/mytab&#93;
    

    NOTE: if you'll add the 3-rd solution into Text Editor of WordPress and after will switch to Visual editor, then your escapes will converted to []