WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/17/2017 08:14:56 PM (3 years ago)
Author:
westonruter
Message:

Customize: Allow post/page stubs to be edited in WP Admin as "customization drafts" when changeset is saved as draft or scheduled.

  • Update stubs to have draft status when changeset is saved as draft, instead of preventing auto-draft garbage collection by giving them a far-future post_date.
  • Show notice in publish metabox when editing a customization draft indicating that it will be published automatically with its changeset; a link to Customizer is included.
  • Include a new "Customization Draft" display post state in the post list table.
  • Disconnect stubs from their changesets when they are updated with a status other than "Draft".
  • Trash customization drafts when their related changeset is trashed or deleted.
  • Add a _customize_changeset_uuid postmeta to stubs to link them with their associated changeset.
  • Include customize_changeset_uuid as context when requesting to insert a new auto-draft.

Props westonruter, melchoyce.
See #39896, #39752, #34923.
Fixes #42220.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/nav-menu.php

    r41766 r41887  
    550550     */
    551551    function test_wp_delete_customize_changeset_dependent_auto_drafts() {
    552         $nav_created_post_ids = $this->factory()->post->create_many(2, array(
     552        $auto_draft_post_id = $this->factory()->post->create( array(
    553553            'post_status' => 'auto-draft',
    554554        ) );
     555        $draft_post_id = $this->factory()->post->create( array(
     556            'post_status' => 'draft',
     557        ) );
     558        $private_post_id = $this->factory()->post->create( array(
     559            'post_status' => 'private',
     560        ) );
     561
     562        $nav_created_post_ids = array(
     563            $auto_draft_post_id,
     564            $draft_post_id,
     565            $private_post_id,
     566        );
    555567        $data = array(
    556568            'nav_menus_created_posts' => array(
     
    567579            'data' => $data,
    568580        ) );
    569         $this->assertInstanceOf( 'WP_Post', get_post( $nav_created_post_ids[0] ) );
    570         $this->assertInstanceOf( 'WP_Post', get_post( $nav_created_post_ids[1] ) );
     581        $this->assertEquals( 'auto-draft', get_post_status( $auto_draft_post_id ) );
     582        $this->assertEquals( 'draft', get_post_status( $draft_post_id ) );
     583        $this->assertEquals( 'private', get_post_status( $private_post_id ) );
    571584        wp_delete_post( $wp_customize->changeset_post_id(), true );
    572         $this->assertNotInstanceOf( 'WP_Post', get_post( $nav_created_post_ids[0] ) );
    573         $this->assertNotInstanceOf( 'WP_Post', get_post( $nav_created_post_ids[1] ) );
     585        $this->assertFalse( get_post_status( $auto_draft_post_id ) );
     586        $this->assertEquals( 'trash', get_post_status( $draft_post_id ) );
     587        $this->assertEquals( 'private', get_post_status( $private_post_id ) );
    574588    }
    575589
Note: See TracChangeset for help on using the changeset viewer.