Support

Account

Home Forums General Issues Include instead of \r\n\r\n WP REST API Reply To: Include instead of \r\n\r\n WP REST API

  • 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 );