Make WordPress Core


Ignore:
Timestamp:
02/21/2017 07:01:07 AM (8 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/manager.php

    r39575 r40098  
    373373                    'post_title' => 'Custom',
    374374                    'thumbnail' => '{{waffles}}',
     375                ),
     376                'unknown_cpt' => array(
     377                    'post_type' => 'unknown_cpt',
     378                    'post_title' => 'Unknown CPT',
    375379                ),
    376380            ),
     
    442446
    443447        $posts_by_name = array();
    444         $this->assertCount( 6, $changeset_values['nav_menus_created_posts'] );
     448        $this->assertCount( 7, $changeset_values['nav_menus_created_posts'] );
    445449        $this->assertContains( $existing_published_home_page_id, $changeset_values['nav_menus_created_posts'], 'Expected reuse of non-auto-draft posts.' );
    446450        $this->assertContains( $existing_canola_attachment_id, $changeset_values['nav_menus_created_posts'], 'Expected reuse of non-auto-draft attachment.' );
     
    462466            $posts_by_name[ $post_name ] = $post->ID;
    463467        }
    464         $this->assertEquals( array( 'waffles', 'canola', 'home', 'about', 'blog', 'custom' ), array_keys( $posts_by_name ) );
     468        $this->assertEquals( array( 'waffles', 'canola', 'home', 'about', 'blog', 'custom', 'unknown-cpt' ), array_keys( $posts_by_name ) );
    465469        $this->assertEquals( 'Custom', get_post( $posts_by_name['custom'] )->post_title );
    466470        $this->assertEquals( 'sample-page-template.php', get_page_template_slug( $posts_by_name['about'] ) );
Note: See TracChangeset for help on using the changeset viewer.