I've had a read of the existing posts on here and still can't see why my instance is doing this, but I'm using wp_insert_post to add a post with some data it's given, and it's inserting the post just fine but the function is returning 0 in place of the post ID - does it have to be triggered to use this?
$ember_prepare_post = array( 'post_author' => $ember_current_user_id, 'post_category' => $ember_post_category, 'post_content' => $ember_post_content, 'post_title' => $ember_post_title, 'post_status' => 'publish', 'post_excerpt' => $ember_post_excerpt, 'tags_input' => $ember_post_tags ); // now we've prepared an array with the data, we're going to save it into the WP database and obtain the resulting post ID. $ember_newpost_id = wp_insert_post($ember_prepare_post, true);
I'm not seeing any errors, and have had a read of the wp_insert_post function itself and cannot see why it wouldn't work. The ID's of the posts it creates definitely aren't zero, either.