731 posts
  • Has referred 500+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+7 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.

2195 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+13 more
mpc 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 ;)

309 posts
  • Has referred 10+ members
  • Provided great contribution to our forums
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+5 more
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
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
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

1022 posts
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
  • Contributed a free file of the month
+6 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
  • Has been part of the Envato Community for over 3 years
  • Has collected 10+ items on Envato Market
  • Located in 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

632 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
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?

1483 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+3 more
OriginalEXE says
632 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
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?

1483 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+3 more
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