There is a bug in WordPress associated with unwanted breaks (<br />) being created after shortcode expansion which causes formatting problems. This post attempts to document a number of possible workarounds.
The bug is documented at http://core.trac.wordpress.org/ticket/14050
The current WordPress documentation for shortcodes says this bug was fixed in WordPress 2.5.1 (we’re now at version 3.0.5).
Here is the relevant text
wpautop recognizes shortcode syntax and will attempt not to wrap p or br tags around shortcodes that stand alone on a line by themselves. Note: in WordPress 2.5.0, shortcodes were parsed before post formatting was applied, so the shortcode output HTML was sometimes wrapped in p or br tags. This was incorrect behaviour that has been fixed in 2.5.1.
The problem is particularly annoying to me, as I spent a couple of hours trying to work out where the extra <br />’s were coming from in my most recent post prior to this one ( Summary of plugins in a WoW website )
Expected behaviour
Two shortcodes on the same line remain on the same line.
Here we can see [ WoW] and [ oik] on the same line
Here we can see WoW and oik on the same line
Wrong behaviour
Two shortcodes on separate lines with an unwanted break
[ WoW]
[ oik]
WoW
oik
OK, this doesn’t look too bad, but in the previous post the shortcodes were formatted as table rows but all the breaks appeared before the table so there was a big vertical gap. Here, let me show you with [ bw_plug name="oik" table="y"] thrice.
| Plugin name and description | Plugin links: WP,homepage,bw notes | Version, total downloads, last update, tested |
|---|---|---|
| oik over 70 lazy smart shortcodes for your WordPress website | oik home | 2.0-beta.0510 2013-05-10 14:42:10 3.6-alpha-23386 |
| Plugin name and description | Plugin links: WP,homepage,bw notes | Version, total downloads, last update, tested |
|---|---|---|
| oik over 70 lazy smart shortcodes for your WordPress website | oik home | 2.0-beta.0510 2013-05-10 14:42:10 3.6-alpha-23386 |
| Plugin name and description | Plugin links: WP,homepage,bw notes | Version, total downloads, last update, tested |
|---|---|---|
| oik over 70 lazy smart shortcodes for your WordPress website | oik home | 2.0-beta.0510 2013-05-10 14:42:10 3.6-alpha-23386 |
Workaround 1A
Put the shortcodes side by side: [ WoW][ oik]
Put the shortcodes side by side: WoWoik
Workaround 1B
All on the same line but with spaces between them as required: [ WoW] [ oik]
All on the same line but with spaces between them as required: WoW oik
Ineffective Workaround 2
If you want to write them on separate lines for ease of reading
WoW
oik
trying leading spaces DOESN’T work.
Ineffective Workaround 3
Trying trailing required spaces doesn’t work either
WoW
oik
The real solution
Either implement the fix provided by the person who found the problem. Thanks aaroncampbell
Or use the wpautop-control plugin to choose on a post by post basis whether or not you want automatic paragraphs and breaks.





Pingback: How to get distracted Part 4A – give me a break? NO DON’T! - herb miller