Empty Shortcode Bug (3 posts)

  1. metal450
    Posted 6 years ago #

    It seems as though shortcode will not allow empty content for non-self-closing tags.

    For instance, [shortcode/] is okay, and [shortcode]hello[/shortcode] is okay, but [shortcode][/shortcode] does not work properly (it outputs strange and unexpected results).

    I don't know jack about RegExps, but I'd really like to be able to support such tags...any tips on how I could remedy this would be greatly appreciated.

    The problem code seems to be in wp-includes/shortcode.php, function do_shortcode().

  2. Konstantin Kovshenin
    Posted 6 years ago #

    Same problem, running 2.8.4

  3. shidouhikari
    Posted 5 years ago #

    Same problem here, it seems that when we add an attribute to a shortcode, we are forced to put something in the content. [shortcode attribute="value"][/p2p] breaks the regex.

    What I've done is test in my plugins:

    if('{{emtpy}}'!=$content) $content=null;

    This way I can use [shortcode attribute="value"]{{emtpy}}[/p2p] and it works fine.

Topic Closed

This topic has been closed to new replies.

About this Topic