wordpresswordpress-rest-apidividivi-theme

Render Divi Tags via WordPress API


I am trying to pull out a page via the WordPress API like so:

/wp-json/wp/v2/pages/MY_PAGE_ID?status=publish

However the page was built using the Divi Page Builder module and includes the various Divi tags in the content such as:

[et_pb_section fb_built=”1″ _builder_version=”4.6.0″ _module_preset=”default” module_alignment=”center” min_height=”627px” custom_padding=”||1px|||”]

I was wondering if there was a way of ensuring that the WordPress API can compile/render the full HTML generated by these tags before it's sent back via JSON to my front-end application?

Thanks very much for your time


Solution

  • Looks like shortcodes. You could try to work with apply_filters() Source: https://developer.wordpress.org/reference/hooks/rest_post_dispatch/

    To filter the shortcodes to actual HTML use the do_shortcode() function. Source: https://developer.wordpress.org/reference/functions/do_shortcode/