See error message from wp_insert_post function?

335 is not an error message or code, it is the new post’s ID that is retuned, so in short, the new post you have inserted was given the ID of 335

UPDATE

wp_insert_post() already returns a WP_Error object on failure, so simply var_dump( $result ); would give you a specific error message on failure or the new post ID on success

Leave a Comment