WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/19/2017 12:00:24 AM (4 years ago)
Author:
westonruter
Message:

Customize: Allow custom post types to be used in starter content.

Changes WP_Customize_Nav_Menus::insert_auto_draft_post() so it can be invoked for a post_type that is not registered (yet).

See #38615, #38114.
Fixes #39610.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/nav-menus.php

    r39506 r39924  
    539539        $this->assertEquals( 'unknown_post_type', $r->get_error_code() );
    540540
    541         $r = $menus->insert_auto_draft_post( array( 'post_type' => 'fake' ) );
     541        // Non-existent post types allowed as of #39610.
     542        $r = $menus->insert_auto_draft_post( array( 'post_title' => 'Non-existent', 'post_type' => 'nonexistent' ) );
     543        $this->assertInstanceOf( 'WP_Post', $r );
     544
     545        $r = $menus->insert_auto_draft_post( array( 'post_type' => 'post' ) );
    542546        $this->assertInstanceOf( 'WP_Error', $r );
    543         $this->assertEquals( 'unknown_post_type', $r->get_error_code() );
     547        $this->assertEquals( 'empty_title', $r->get_error_code() );
    544548
    545549        $r = $menus->insert_auto_draft_post( array( 'post_status' => 'publish', 'post_title' => 'Bad', 'post_type' => 'post' ) );
Note: See TracChangeset for help on using the changeset viewer.