Submitting posts from the front end – sanitizing data

When a post is created/edited from the admin, edit_post() is called.

This function simply collects all the $_POST arguments and passes them to wp_update_post().

wp_update_post() then does some more logical checks and passes the data along to wp_insert_post().

wp_insert_post() calls sanitize_post(), which does all the heavy duty sanitization.

So, yes, wp_insert_post() is the correct way to do it.

Leave a Comment