I'm trying to get rid of the shortcodes that wordpress gives me when i use the WP REST API. I already managed to remove the HTML tags by editing the class-wp-rest-posts-controller.php
by using strip_tags()
. But i don't seem to find a solution for the short codes.
I tried several solutions that did not work. like write this code on the functions.php
// Removes Divi shortcodes
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
or that
$content = strip_tags( do_shortcode( $post->post_content ) );
I'm maybe doing something wrong I'm kinda new at this. if you guys could help me it would be awesome.