use_block_editor_for_post example



                    if ( $post_id ) {
                        $post = get_post( $post_id );
                        if ( $post ) {
                            $post_type = $post->post_type;

                            /** This filter is documented in wp-admin/post.php */
                            $replace_editor = apply_filters( 'replace_editor', false, $post );

                            if ( ! $replace_editor ) {
                                $is_block_editor = use_block_editor_for_post( $post );
                            }
                        }
                    }
                    break;
                case 'edit-tags':
                case 'term':
                    if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) {
                        $post_type = 'post';
                    }
                    break;
                case 'upload':
                    

        if ( true === apply_filters( 'replace_editor', false, $post ) ) {
            break;
        }

        if ( use_block_editor_for_post( $post ) ) {
            require ABSPATH . 'wp-admin/edit-form-blocks.php';
            break;
        }

        if ( ! wp_check_post_lock( $post->ID ) ) {
            $active_post_lock = wp_set_post_lock( $post->ID );

            if ( 'attachment' !== $post_type ) {
                wp_enqueue_script( 'autosave' );
            }
        }

        
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
        '<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>',
        403
    );
}

$post    = get_default_post_to_edit( $post_type, true );
$post_ID = $post->ID;

/** This filter is documented in wp-admin/post.php */
if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
    if ( use_block_editor_for_post( $post ) ) {
        require ABSPATH . 'wp-admin/edit-form-blocks.php';
    } else {
        wp_enqueue_script( 'autosave' );
        require ABSPATH . 'wp-admin/edit-form-advanced.php';
    }
} else {
    // Flag that we're not loading the block editor.     $current_screen = get_current_screen();
    $current_screen->is_block_editor( false );
}

Home | Imprint | This part of the site doesn't use cookies.