Title: Empty Shortcode Bug
Last modified: August 19, 2016

---

# Empty Shortcode Bug

 *  [kuprosa](https://wordpress.org/support/users/metal450/)
 * (@metal450)
 * [17 years ago](https://wordpress.org/support/topic/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)

 *  [Konstantin Kovshenin](https://wordpress.org/support/users/kovshenin/)
 * (@kovshenin)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/empty-shortcode-bug/#post-1080904)
 * Same problem, running 2.8.4
 *  [shidouhikari](https://wordpress.org/support/users/shidouhikari/)
 * (@shidouhikari)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/empty-shortcode-bug/#post-1080924)
 * 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.

## Tags

 * [empty](https://wordpress.org/support/topic-tag/empty/)
 * [regex](https://wordpress.org/support/topic-tag/regex/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [trac](https://wordpress.org/support/topic-tag/trac/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 3 participants
 * Last reply from: [shidouhikari](https://wordpress.org/support/users/shidouhikari/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/empty-shortcode-bug/#post-1080924)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
