[wp-trac] [WordPress Trac] #28789: wp_insert_post() only creates draft posts
WordPress Trac
noreply at wordpress.org
Tue Jul 8 06:16:28 UTC 2014
#28789: wp_insert_post() only creates draft posts
--------------------------+-----------------------------
Reporter: Ehsaan | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.9.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I use a custom post type (hooked in init) and I've created a form for
submitting in front-end and added a hook in init for listening form
submitting and then create a post.
Here is my code:
{{{
do_action( 'wpo_frontend_before_save_order', $order_details, $user_details
);
$post = array(
'post_title' =>
$order_details['title'],
'post_author' =>
get_current_user_id(),
'post_type' =>
'wp_order',
'post_status' => 'pending'
);
$postID = wp_insert_post( $post );
if ( is_wp_error( $postID ) ) {
set_transient( 'wpo_new_order_message_' .
get_current_user_id(), __( 'There was a problem to register your order.
Please try again later', 'wpo' ) );
return;
}
}}}
It creates only draft posts, it doesn't update post_date and post_date_gmt
too and I can't delete its posts from WordPress (I delete them from
database)
I don't know how to fix it. This is a bad problem.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28789>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list