Preg_replace can it ignore shortcodes?
-
I am using this preg_replace code to change all imgur links on my site:
add_filter('wp_insert_post_data', 'pm_add_memegen'); function pm_add_memegen( $data ) { $data['post_content'] = preg_replace('/imgur.com\/(?!memegen\/create)/', 'imgur.com/memegen/create/', $data['post_content']); return $data; }
But this also affects a Shortcode I have to use to display Imgur ablums which I do not want, because the shortcode will break.
[wpws url="https://imgur.com/a/zaNdd/all" query=".posts"]
Is there a way I can force the preg_replace code to ignore the shortcode and only affect the images displayed on my site?
Thanks
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Preg_replace can it ignore shortcodes?’ is closed to new replies.