I’m trying to get raw content through REST API
When I call “http://mysite.tld/wp-json/wp/v2/pages/456” I receive rendered content
"content": {
"rendered": "<div id=\"something\"></div>\n",
"protected": false
},
but I want the content to be unrendered
LE: I found something in /wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
if ( ! empty( $schema['properties']['content'] ) ) {
$data['content'] = array(
'raw' => $post->post_content,
/** This filter is documented in wp-includes/post-template.php */
'rendered' => post_password_required( $post ) ? '' : apply_filters( 'the_content', $post->post_content ),
'protected' => (bool) $post->post_password,
);
}
If I replace
'rendered' => post_password_required( $post ) ? '' : apply_filters( 'the_content', $post->post_content ),
with
'rendered' => $post->post_content,
it works well but how can I edit this from a custom plugin?
btw: i noticed “raw” is missing from api response