WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/17/2017 08:14:56 PM (4 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/src/wp-includes/class-wp-customize-nav-menus.php

    r41868 r41887  
    795795        }
    796796
     797        /*
     798         * If the changeset is a draft, this will change to draft the next time the changeset
     799         * is updated; otherwise, auto-draft will persist in autosave revisions, until save.
     800         */
    797801        $postarr['post_status'] = 'auto-draft';
    798802
     
    805809        }
    806810        $postarr['meta_input']['_customize_draft_post_name'] = $postarr['post_name'];
     811        $postarr['meta_input']['_customize_changeset_uuid'] = $this->manager->changeset_uuid();
    807812        unset( $postarr['post_name'] );
    808813
     
    11731178
    11741179    /**
    1175      * Sanitize post IDs for auto-draft posts created for nav menu items to be published.
     1180     * Sanitize post IDs for posts created for nav menu items to be published.
    11761181     *
    11771182     * @since 4.7.0
     
    11871192            }
    11881193            $post = get_post( $post_id );
    1189             if ( 'auto-draft' !== $post->post_status ) {
     1194            if ( 'auto-draft' !== $post->post_status && 'draft' !== $post->post_status ) {
    11901195                continue;
    11911196            }
     
    12181223        if ( ! empty( $post_ids ) ) {
    12191224            foreach ( $post_ids as $post_id ) {
     1225
     1226                // Prevent overriding the status that a user may have prematurely updated the post to.
     1227                $current_status = get_post_status( $post_id );
     1228                if ( 'auto-draft' !== $current_status && 'draft' !== $current_status ) {
     1229                    continue;
     1230                }
     1231
    12201232                $target_status = 'attachment' === get_post_type( $post_id ) ? 'inherit' : 'publish';
    12211233                $args = array(
Note: See TracChangeset for help on using the changeset viewer.