I’ve seen the tutorials on creating a (raw) shortcode that leaves the code inside it untouched,
http://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode
but unfortunately this only applies to one shortcode at a time… and because the else
statement bypasses the normal filters and calls the functions directions. My other modifications to autop and texturize functions get ignored.
Is there a way to 1. match multiple shortcodes and 2. preserve my other add/remove filters to the_content?
After implementing @helgatheviking’s solution on multiple websites, I’m convinced that only these lines are required:
Put them in your
functions.php
file and you’re set.I solved this as best as possible by combining a slightly modified parse_shortcode_content function from Donal MacArthur (his originally manually calls wpautop… which I’ve removed. With the re-ordering of default filters to run wpautop much later… after the shortcode has already been processed instead of before.
and moving the filters
EDIT:
The
parse_shortcode_content()
function is no longer required (if it ever was). Simply adjust the filter order.In my case – this solution has broken one of the side shortcodes (revslider).
So I’ve found another solution here:
http://wordpress-hackers.1065353.n5.nabble.com/shortcode-unautop-tp42085p42086.html
Which is to use another filter like this:
It works fine for me 🙂
Please see my answer here:
Remove wpautop from shortcode content / remove whitespace in buffering
It allows you to turn off wpautop for as many specific shortcodes as you want using this: