Changeset 61360
- Timestamp:
- 12/08/2025 09:53:05 PM (5 days ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-admin/includes/post.php (modified) (1 diff)
-
tests/phpunit/tests/admin/includesPost.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r60701 r61360 765 765 $post_id = wp_insert_post( 766 766 array( 767 'post_title' => __( 'Auto Draft' ),767 'post_title' => post_type_supports( $post_type, 'title' ) ? __( 'Auto Draft' ) : '', 768 768 'post_type' => $post_type, 769 769 'post_status' => 'auto-draft', -
trunk/tests/phpunit/tests/admin/includesPost.php
r60701 r61360 547 547 $this->expectException( 'WPDieException' ); 548 548 get_default_post_to_edit( 'post', true ); 549 } 550 551 /** 552 * Tests that default post title is present when a CPT has title support, and is empty otherwise. 553 * 554 * @ticket 45516 555 * 556 * @covers ::get_default_post_to_edit 557 */ 558 public function test_get_default_post_to_edit_with_and_without_title_support() { 559 register_post_type( 560 'yes_title', 561 array( 562 'supports' => array( 'title', 'editor' ), 563 ) 564 ); 565 register_post_type( 566 'no_title', 567 array( 568 'supports' => array( 'editor' ), 569 ) 570 ); 571 572 /* 573 * The ID is obtained because get_default_post_to_edit() will force the post_title 574 * to be overridden on the returned WP_Post object. 575 */ 576 $default_yes_title_post_id = get_default_post_to_edit( 'yes_title', true )->ID; 577 $default_no_title_post_id = get_default_post_to_edit( 'no_title', true )->ID; 578 579 $this->assertSame( __( 'Auto Draft' ), get_post( $default_yes_title_post_id )->post_title, 'Expected post_title to be the default title.' ); 580 $this->assertSame( '', get_post( $default_no_title_post_id )->post_title, 'Expected post_title to be an empty string.' ); 549 581 } 550 582
Note: See TracChangeset
for help on using the changeset viewer.