Changeset 45906
- Timestamp:
- 08/29/2019 02:09:42 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-xmlrpc-server.php
r45823 r45906 1709 1709 } 1710 1710 1711 /* 1712 * If the API client did not provide post_date, then we must not perpetuate the value that was 1713 * stored in the database, or it will appear to be an intentional edit. Conveying it here as if 1714 * it was coming from the API client will cause an otherwise zeroed out post_date_gmt to get set 1715 * with the value that was originally stored in the database when the draft was created. 1716 */ 1717 if ( ! isset( $content_struct['post_date'] ) ) { 1718 unset( $post['post_date'] ); 1719 } 1720 1711 1721 $this->escape( $post ); 1712 1722 $merged_content_struct = array_merge( $post, $content_struct ); -
trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php
r45607 r45906 497 497 $this->assertEquals( $future_date_string, $after->post_date ); 498 498 } 499 500 /** 501 * @ticket 45322 502 */ 503 function test_draft_not_assigned_published_date() { 504 $editor_id = $this->make_user_by_role( 'editor' ); 505 506 // Start with a draft post, confirming its post_date_gmt is "zero". 507 $post = array( 508 'post_title' => 'Test', 509 'post_status' => 'draft', 510 ); 511 $post_id = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 512 513 $before = get_post( $post_id ); 514 $this->assertEquals( '0000-00-00 00:00:00', $before->post_date_gmt ); 515 516 // Edit the post without specifying any dates. 517 $new_post_content = array( 518 'ID' => $post_id, 519 'post_title' => 'Updated', 520 ); 521 522 $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $new_post_content ) ); 523 524 // The published date should still be zero. 525 $after = get_post( $post_id ); 526 $this->assertEquals( '0000-00-00 00:00:00', $after->post_date_gmt ); 527 } 499 528 }
Note: See TracChangeset
for help on using the changeset viewer.