731 posts
  • Elite Author
  • Attended a Community Meetup
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Bought between 50 and 99 items
  • Exclusive Author
  • Most Wanted Bounty Winner
+2 more
mordauk says

@cosmincotor there really isn’t a great code snippet out there. I would personally recommend not trying to use any code snippet as every single one of them goes against what should be happening.

I also wouldn’t be including short codes (except very specialized ones in your themes). For example, if you want to add columns, suggest your users install this plugin: https://github.com/justintadlock/grid-columns

The problem is actually an issue with WordPress, not themes (except themes that try to fix it). The best thing to do is work on fixing the issue in core and submit a patch.

2177 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 5-6 years
  • Won a Competition
+10 more
mpc Volunteer moderator says

Would be nice to provide the fix since you started the thread and others may be intersted :d

I have used this plugin, those of the users who will have a problem with the paragraph tags and breaks added to the shortcodes will use it and the others wont. Maybe it’s not the best… next time I will try the solution from this topic ;)

292 posts
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Europe
  • Bought between 50 and 99 items
  • Referred between 10 and 49 users
  • Envato Studio (Microlancer) Beta Tester
  • Has been a member for 3-4 years
cosmincotor says

@cosmincotor there really isn’t a great code snippet out there. I would personally recommend not trying to use any code snippet as every single one of them goes against what should be happening.

I also wouldn’t be including short codes (except very specialized ones in your themes). For example, if you want to add columns, suggest your users install this plugin: https://github.com/justintadlock/grid-columns

The problem is actually an issue with WordPress, not themes (except themes that try to fix it). The best thing to do is work on fixing the issue in core and submit a patch.

Well, I guess I’ll have to re-think the shortcodes (which ones are absolutely necessary), and hopefully WP will receive an update that deals with this issue.

Thanks :)

no-thumbnail
AvantInnovations Recent Posts Threads Started
1 post
  • Bought between 10 and 49 items
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
AvantInnovations says


@cosmincotor there really isn’t a great code snippet out there. I would personally recommend not trying to use any code snippet as every single one of them goes against what should be happening.

I also wouldn’t be including short codes (except very specialized ones in your themes). For example, if you want to add columns, suggest your users install this plugin: https://github.com/justintadlock/grid-columns

The problem is actually an issue with WordPress, not themes (except themes that try to fix it). The best thing to do is work on fixing the issue in core and submit a patch.

Well, I guess I’ll have to re-think the shortcodes (which ones are absolutely necessary), and hopefully WP will receive an update that deals with this issue.

Thanks :)

I wouldnt hold your breath

904 posts
  • Author had a Free File of the Month
  • Grew a moustache for the Envato Movember competition
  • Sold between 10 000 and 50 000 dollars
  • Beta Tester
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • Has been a member for 1-2 years
+1 more
greenline says
There are many best-selling TF themes which still use for instance: $new_content .= wptexturize(wpautop($piece));

This forces wpautop and messes up the content generated by the new plugin I am working at. It adds <p></p> to my generated content and I haven’t found any good solution yet to get rid of the <p></p> added

I thought theme authors are not allowed to force wpautop?? Or are they?

13 posts
  • Bought between 10 and 49 items
  • Has been a member for 3-4 years
  • United Kingdom
ruudbwai says

So what’s the verdict, I’m writing a theme, and definitely need to use the shortcode empty paragraph fix posted…will theme get rejected because of this?

Otherwise the wpautop wreaks havoc with my shortcodes :p

631 posts
  • United Kingdom
  • Sold between 10 000 and 50 000 dollars
  • Most Wanted Bounty Winner
  • Interviewed on the Envato Notes blog
  • Referred between 50 and 99 users
  • Bought between 50 and 99 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 2-3 years
UBLThemes says

Hi, just had a theme soft rejected and one of the reasons was for using:

function shortcode_empty_paragraph_fix($content){   
    $array = array (
        '<p>[' => '[', 
        ']</p>' => ']', 
        ']<br />' => ']'
    );

    $content = strtr($content, $array);
    return $content;
}

Ive always used this but it looks like this is no longer allowed, what are you doing to do this?

1465 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says
631 posts
  • United Kingdom
  • Sold between 10 000 and 50 000 dollars
  • Most Wanted Bounty Winner
  • Interviewed on the Envato Notes blog
  • Referred between 50 and 99 users
  • Bought between 50 and 99 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 2-3 years
UBLThemes says

Check this out: https://gist.github.com/bitfade/4555047

That is basically doing the same thing, so why would that pass and the one I am doing not?

1465 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says


Check this out: https://gist.github.com/bitfade/4555047
That is basically doing the same thing, so why would that pass and the one I am doing not?
There is one big difference, your code affects all shortcodes, but with the code I linked you have the control over what shortcodes get “cleaned”
by
by
by
by
by
by