Skip to content

Block editor

The WordPress block editor is the content editing and site building experience built into WordPress core.

Upcoming beta features for the block editor can be tested by installing and activating the Gutenberg plugin on a non-production environment.


The Gutenberg plugin is only intended for testing and development purposes, and should not be added to a production environment due to the experimental nature of the releases.

The block editor is the WordPress editor enabled by default, replacing the classic editor. It is possible to selectively enable the Classic Editor with filters.

Disable for all post types

Loading behavior is controlled by setting use_block_editor_for_post to __return_true or __return_false. This setting should be added to a theme’s functions.php and will affect all post types.

In this example, the block editor is disabled for all post types:

add_filter( 'use_block_editor_for_post', '__return_false'  );

If this filter is set in multiple places in an application’s code, the filter priority might need to be changed.

Disable for specific post types

Enabling the block editor for specific post types requires that the post type is registered with 'show_in_rest' => true. The block editor depends on the REST API, and if the post type is not shown in the REST API it will not work with the block editor.

In this example, the block editor is set to load only for page post types:

function maybe_load_gutenberg_for_post_type( $can_edit, $post ) {
        $enable_for_post_types = [ 'page' ];
        if ( in_array( $post->post_type, $enable_for_post_types, true ) ) {
                return true;
        return false;
add_filter( 'use_block_editor_for_post', 'maybe_load_gutenberg_for_post_type', 15, 2 );

Enable or disable for specific post IDs

The block editor can be selectively enabled for specific post IDs while remaining disabled for all other posts.

In this example, the block editor is only enabled for post IDs 114, 285, and 352:

function maybe_load_gutenberg_for_post_id( $can_edit, $post ) {
     $enable_for_post_ids = array( 114, 285, 352 );

     if ( in_array( $post->ID, $enable_for_post_ids, true ) ) {
          return true;

     return false;

add_filter( 'use_block_editor_for_post', 'maybe_load_gutenberg_for_post_id', 20, 2 );

To selectively disable the block editor for specific post IDs, modify the above example to return false instead of true for post IDs not in the $enable_for_post_ids array.

Last updated: December 22, 2023

Relevant to

  • WordPress