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/manager.php

    r39561 r39924  
    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.