Setting post_date_gmt on drafts
-
This is basically the same question as a previous forum post. I’m using
wp_insert_post()
to create drafts. For drafts, thepost_modified
field is set to the current date, but thepost_modified_gmt
field is set to ‘0000-00-00 00:00:00’. From the code in /wp-includes/post.php, it looks intentional:if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['post_date_gmt'] ) { if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) { $post_date_gmt = get_gmt_from_date( $post_date ); } else { $post_date_gmt = '0000-00-00 00:00:00'; }
I was tempted to file a bug report, but I thought I’d check to see if someone could explain the reason for not setting
post_modified_gmt
ifpost_modified
is going to be set.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Setting post_date_gmt on drafts’ is closed to new replies.