WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/21/2017 07:01:07 AM (5 years ago)
Author:
dd32
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).

Props westonruter.
Merges [39924] to the 4.7 branch.
See #38615, #38114.
Fixes #39610.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/tests/phpunit/tests/customize/nav-menus.php

    r39507 r40098  
    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.