filters – Problem width wp_insert_post_data and Gutenberg block editor
I need to change the post title of a Custom Post Type before save it. I have try with wp_insert_post_data filter and works fine. The problem is that normal posts that uses Gutenberg fires an error “the response is not a valid JSON response” when save it although it’s not applied the filter in this case.
Any suggestions?. Is it possible to fire the wp_insert_post_data filter only width the CPT that uses it. Actually the filter is launched always and is necessary check the post type to make the action.
I have found some information pointed to the REST API mechanism that Gutenberg uses but without any conclusions.
Thanks in advance