Changeset 46279
- Timestamp:
- 09/23/2019 09:01:16 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r46275 r46279 3728 3728 3729 3729 if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['post_date_gmt'] ) { 3730 if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' )) ) {3730 if ( ! in_array( $post_status, get_post_stati( array( 'date_floating' => true ) ), true ) ) { 3731 3731 $post_date_gmt = get_gmt_from_date( $post_date ); 3732 3732 } else { -
trunk/tests/phpunit/tests/post.php
r45607 r46279 1395 1395 return 'override-slug-' . $post_type; 1396 1396 } 1397 1398 /** 1399 * @ticket 48113 1400 */ 1401 public function test_insert_post_should_respect_date_floating_post_status_arg() { 1402 register_post_status( 'floating', array( 'date_floating' => true ) ); 1403 1404 $post_id = self::factory()->post->create( 1405 array( 1406 'post_status' => 'floating', 1407 'post_date' => null, 1408 'post_date_gmt' => null, 1409 ) 1410 ); 1411 1412 $post = get_post( $post_id ); 1413 self::assertEquals( '0000-00-00 00:00:00', $post->post_date_gmt ); 1414 } 1415 1416 /** 1417 * @ticket 48113 1418 */ 1419 public function test_insert_post_should_respect_date_floating_post_status_arg_not_set() { 1420 register_post_status( 'not-floating', array( 'date_floating' => false ) ); 1421 1422 $post_id = self::factory()->post->create( 1423 array( 1424 'post_status' => 'floating', 1425 'post_date' => null, 1426 'post_date_gmt' => null, 1427 ) 1428 ); 1429 1430 $post = get_post( $post_id ); 1431 self::assertEquals( gmdate( 'Y-m-d H:i:s' ), $post->post_date_gmt ); 1432 } 1397 1433 }
Note: See TracChangeset
for help on using the changeset viewer.