WordPress.org

Make WordPress Core

Ticket #42119: 42119.patch

File 42119.patch, 2.9 KB (added by azaozz, 3 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    1717 */
    1818global $post_type, $post_type_object, $post;
    1919
     20if ( is_multisite() ) {
     21        add_action( 'admin_footer', '_admin_notice_post_locked' );
     22} else {
     23        $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
     24
     25        if ( count( $check_users ) > 1 )
     26                add_action( 'admin_footer', '_admin_notice_post_locked' );
     27
     28        unset( $check_users );
     29}
     30
    2031wp_enqueue_script('post');
    2132$_wp_editor_expand = $_content_editor_dfw = false;
    2233
  • src/wp-admin/post-new.php

     
    6363}
    6464
    6565// Schedule auto-draft cleanup
    66 if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
     66if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) {
    6767        wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
     68}
    6869
    69 wp_enqueue_script( 'autosave' );
     70$post = get_default_post_to_edit( $post_type, true );
     71$post_ID = $post->ID;
    7072
    71 if ( is_multisite() ) {
    72         add_action( 'admin_footer', '_admin_notice_post_locked' );
    73 } else {
    74         $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
    75 
    76         if ( count( $check_users ) > 1 )
    77                 add_action( 'admin_footer', '_admin_notice_post_locked' );
    78 
    79         unset( $check_users );
     73// Let plugins replace the whole editor.
     74if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
     75        wp_enqueue_script( 'autosave' );
     76        include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
    8077}
    8178
    82 // Show post form.
    83 $post = get_default_post_to_edit( $post_type, true );
    84 $post_ID = $post->ID;
    85 include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
    8679include( ABSPATH . 'wp-admin/admin-footer.php' );
  • src/wp-admin/post.php

     
    144144                $post_new_file = "post-new.php?post_type=$post_type";
    145145        }
    146146
     147        // Let plugins replace the whole editor.
     148        if ( apply_filters( 'replace_editor', false, $post ) === true ) {
     149                break;
     150        }
     151
    147152        if ( ! wp_check_post_lock( $post->ID ) ) {
    148153                $active_post_lock = wp_set_post_lock( $post->ID );
    149154
     
    151156                        wp_enqueue_script('autosave');
    152157        }
    153158
    154         if ( is_multisite() ) {
    155                 add_action( 'admin_footer', '_admin_notice_post_locked' );
    156         } else {
    157                 $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
    158 
    159                 if ( count( $check_users ) > 1 )
    160                         add_action( 'admin_footer', '_admin_notice_post_locked' );
    161 
    162                 unset( $check_users );
    163         }
    164 
    165159        $title = $post_type_object->labels->edit_item;
    166160        $post = get_post($post_id, OBJECT, 'edit');
    167161