Make WordPress Core

Ticket #53813: 53813.diff

File 53813.diff, 1.1 KB (added by h71, 4 years ago)
  • src/wp-admin/edit-form-blocks.php

    diff --git a/src/wp-admin/edit-form-blocks.php b/src/wp-admin/edit-form-blocks.php
    index 7e335fa49b..3853527868 100644
    a b wp_add_inline_script( 
    7777 * Assign initial edits, if applicable. These are not initially assigned to the persisted post,
    7878 * but should be included in its save payload.
    7979 */
    80 $initial_edits = null;
     80$initial_edits = array();
    8181$is_new_post   = false;
    8282if ( 'auto-draft' === $post->post_status ) {
    8383        $is_new_post = true;
    8484        // Override "(Auto Draft)" new post default title with empty string, or filtered value.
    85         $initial_edits = array(
    86                 'title'   => $post->post_title,
    87                 'content' => $post->post_content,
    88                 'excerpt' => $post->post_excerpt,
    89         );
     85        if ( post_type_supports( $post->post_type, 'title' ) ) {
     86                $initial_edits['title'] = $post->post_title;
     87        }
     88
     89        if ( post_type_supports( $post->post_type, 'content' ) ) {
     90                $initial_edits['content'] = $post->post_content;
     91        }
     92
     93        if ( post_type_supports( $post->post_type, 'excerpt' ) ) {
     94                $initial_edits['excerpt'] = $post->post_excerpt;
     95        }
     96
    9097}
    9198
    9299// Preload server-registered block schemas.