WordPress.org

Support

Support » How-To and Troubleshooting » Empty Shortcode Bug

Empty Shortcode Bug

  • 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().

Viewing 2 replies - 1 through 2 (of 2 total)
  • Same problem, running 2.8.4

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Empty Shortcode Bug’ is closed to new replies.
Skip to toolbar