You should use the transition_post_status
to filter the content after submitting the post.
Try the below code in the functions.php
in your theme:
add_action( 'transition_post_status', '_new_post', 10, 3 );
function _new_post( $new_status, $old_status, $post ) {
if ( 'publish' !== $new_status or 'publish' === $old_status ) {
return;
}
if ( 'post' !== $post->post_type ) {
return;
} // restrict the filter to a specific post type
$plain_content = strip_tags( $post->post_content );
$new_post = array(
'ID' => $post->ID,
'post_content' => $plain_content,
);
wp_update_post( $new_post );
}