Bricks Page Content in REST API

I am using the WP Rest API /wp-json/wp/v2/pages to retrieve the content of the wordpress pages. Pages built with Bricks however do not contain the Page content in the WP-Rest API response and the attribute content.rendered is only an empty string.

Is this a bug or intented to work like this? How can I retrieve the page content programmatically?

bricks pages are not saved on the the_content

they are saved on the postmeta table a.k.a. custom fields meta key is usualy: _bricks_page_content_2

I am well aware that the bricks page content isn’t stored in the content field. But the REST API field content.rendered is supposed to return the content as rendered by wordpress on the page. Not the raw “content” data of the wordpress post/page. So my expectation was that the HTML code generated by bricks is returned.

I’ve now created my own API endpoint where I return the bricks rendered content using the bricks_template shortcode along with the CSS (using the Assets::generate_inline_css method) and it works reasonably well.

But if anyone knows a bricks native way to get at the content it would be appreciated.

2 Likes