[wp-hackers] Remove only certain shortcodes
Dino Termini
dino at duechiacchiere.it
Mon Mar 24 17:06:51 UTC 2014
Nicholas, you saved my day ;)
In case other people are interested in the solution:
|$exclude_codes = 'shortcode_to_keep_1|keep_this_shortcode|another_shortcode_to_keep';
$the_content = get_the_content();
$the_content= preg_replace("~(?:\[/?)(?!(?:$exclude_codes))[^/\]]+/?\]~s", '', $the_content); # strip shortcodes, keep shortcode content
|
Thank you
On 3/24/14, 12:59 PM, Nicholas Ciske wrote:
> http://wordpress.org/support/topic/stripping-shortcodes-keeping-the-content?replies=16
>
>
More information about the wp-hackers
mailing list