Forums

How do I prevent a shortcode from activating in a specific page? (3 posts)

  1. AimeeTheGreat
    Member
    Posted 4 months ago #

    Using the latest version of WordPress. One of my plugins used a shortcode within square brackets. Unfortunately it used a common word and it activated in one of my pages in the middle of a paragraph with hilarious effects. Anyways, I use the shortcode elsewhere so I don't want to disable it entirely. How do I disable it for a specific page?

    I temporarily changed the square-brackets to regular brackets but that's not really the best solution.

    Thanks.

  2. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 months ago #

    One way around this issue would be to use the html character entities for the square brackets

    [ = & #91;
    ] = & #93;

    (without the space after the ampersand)

    Unfortunately going into the visual editor will convert the character entities into [ ] again

    Another way would be to create a shortcode to enclose the content in square brackets and make that into a plugin - or put it into functions.php, so typing [square]text[/square] will come out as [text]

  3. roidayan
    Member
    Posted 3 months ago #

    I myself only use plugins that use the shortcode api and not doing regexp on the post content.
    Then if in the post you use double brackets like shortcode it wont activate the shortcode callback and will show as [shortcode].

Reply

You must log in to post.

About this Topic

Tags