Editor: Add the replace_editor filter.

This filter allows the Core editor to be replaced by an entirely different editor (coughcoughGUTENBERGcough).

Props azaozz, who is supposed to be on sabbatical right now.
Fixes #42119.



git-svn-id: https://develop.svn.wordpress.org/trunk@41829 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-10-11 12:05:21 +00:00
parent 4a23f58215
commit 3b734f0e65
3 changed files with 31 additions and 26 deletions

View File

@@ -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');