I have the problem of receiving a response back from the WordPress REST API as follows while using the ACF to REST API plugin:
– content.rendered
includes <p>
tags
– acf. ... .post_content
includes \r\n\r\n
In both cases, each property source is the WordPress editor.
I require both to return <p>
tags.
I do not know how to configure this as desired.
From your description it appears that the plugin is not applying filters to the ACF wysiwyg fields.
The ACF to rest API is a 3rd party plugin. I hate to do this to you but you should contact the developer of that plugin or ask them the question. The reason I hate to do this is that it does not appear that plugin is being maintained.
I did some looking and I did find this on the github repo https://github.com/airesvsg/acf-to-rest-api/issues/215
I would amend that code because if the plugin is not applying autop then it not running any filters on the fields.
add_filter( 'acf/rest_api/{type}/get_fields', function( $data, $response ) {
if ( isset( $data['acf']['my_field'] ) ) {
// my change here
$data['acf']['my_field']->post_content = apply_filters('acf_the_content', $data['acf']['my_field']->post_content );
}
return $data;
}, 10, 2 );
Thank you so much! Sorry for the very very belated response.