WordPress REST API – JSON “Rendered” Content Incorrect

The content that you are referring to is coming from the Elegant Themes Page Builder plugin on that site.

The page builder uses WordPress Shortcodes to render the content on the WordPress site. However, when you use the REST API, the content is pulled from the WordPress database and the shortcodes are not processed/rendered first.

You would need to remove the shortcodes from the returned JSON before it is displayed in your app. You could use something like this to remove the shortcodes before displaying your content in the app:

// Remove Divi/ET Page Builder shortcodes
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);

Leave a Comment