WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/11/2017 12:05:21 PM (2 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/post-new.php

    r38076 r41829  
    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 
    69 wp_enqueue_script( 'autosave' );
    70 
    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 );
    8068}
    8169
    82 // Show post form.
    8370$post = get_default_post_to_edit( $post_type, true );
    8471$post_ID = $post->ID;
    85 include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
     72
     73/** This filter is documented in wp-admin/post.php */
     74if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
     75    wp_enqueue_script( 'autosave' );
     76    include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
     77}
     78
    8679include( ABSPATH . 'wp-admin/admin-footer.php' );
Note: See TracChangeset for help on using the changeset viewer.