diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 2db7e90c5f..07c2dfe129 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -17,6 +17,17 @@ if ( !defined('ABSPATH') ) */ global $post_type, $post_type_object, $post; +if ( is_multisite() ) { + add_action( 'admin_footer', '_admin_notice_post_locked' ); +} else { + $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); + + if ( count( $check_users ) > 1 ) + add_action( 'admin_footer', '_admin_notice_post_locked' ); + + unset( $check_users ); +} + wp_enqueue_script('post'); $_wp_editor_expand = $_content_editor_dfw = false; diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php index ac80f1350f..46e402ab0c 100644 --- a/wp-admin/post-new.php +++ b/wp-admin/post-new.php @@ -63,24 +63,17 @@ if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_ } // Schedule auto-draft cleanup -if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) +if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); - -wp_enqueue_script( 'autosave' ); - -if ( is_multisite() ) { - add_action( 'admin_footer', '_admin_notice_post_locked' ); -} else { - $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); - - if ( count( $check_users ) > 1 ) - add_action( 'admin_footer', '_admin_notice_post_locked' ); - - unset( $check_users ); } -// Show post form. $post = get_default_post_to_edit( $post_type, true ); $post_ID = $post->ID; -include( ABSPATH . 'wp-admin/edit-form-advanced.php' ); + +/** This filter is documented in wp-admin/post.php */ +if ( apply_filters( 'replace_editor', false, $post ) !== true ) { + wp_enqueue_script( 'autosave' ); + include( ABSPATH . 'wp-admin/edit-form-advanced.php' ); +} + include( ABSPATH . 'wp-admin/admin-footer.php' ); diff --git a/wp-admin/post.php b/wp-admin/post.php index cf2bee5790..dbfb156430 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -144,6 +144,18 @@ case 'edit': $post_new_file = "post-new.php?post_type=$post_type"; } + /** + * Allows replacement of the editor. + * + * @since 4.9.0 + * + * @param boolean Whether to replace the editor. Default false. + * @param object $post Post object. + */ + if ( apply_filters( 'replace_editor', false, $post ) === true ) { + break; + } + if ( ! wp_check_post_lock( $post->ID ) ) { $active_post_lock = wp_set_post_lock( $post->ID ); @@ -151,17 +163,6 @@ case 'edit': wp_enqueue_script('autosave'); } - if ( is_multisite() ) { - add_action( 'admin_footer', '_admin_notice_post_locked' ); - } else { - $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); - - if ( count( $check_users ) > 1 ) - add_action( 'admin_footer', '_admin_notice_post_locked' ); - - unset( $check_users ); - } - $title = $post_type_object->labels->edit_item; $post = get_post($post_id, OBJECT, 'edit'); diff --git a/wp-includes/version.php b/wp-includes/version.php index 1d09cf55e2..f4e97b77b1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-beta1-41828'; +$wp_version = '4.9-beta1-41829'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.