Let's say I want to edit the content that is being saved to the DB in wordpress for all posts. Here I'm just setting it to XYZ as an example. Ideally it would update the content in Gutenberg editor or force a reload. I added an action to pre_post_update:
add_action( 'pre_post_update', 'updateContent', 2, 3 );
public function updateContent($post_ID, $post_data)
{
$post_data['post_content'] = 'XYZ';
return ($post_data);
}
But this doesn't change the data that's saved. How can I do that?