[wp-hackers] Remove only certain shortcodes

Nashwan Doaqan nashwan.doaqan at gmail.com
Mon Mar 24 17:13:52 UTC 2014


hmmm.. I am using Moody Shortcodes for this kind of things:
https://wordpress.org/plugins/wp-moody-shortcodes/


On 24 March 2014 20:06, Dino Termini <dino at duechiacchiere.it> wrote:

> 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
>>
>>
>>  _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list