CPT loads as a white screen in WordPress block editor

When you’re finally ready to try a new editor, it’s frustrating to run into problems like this. Luckily, there’s a quick fix.

Fix: enable show_in_rest for your CPT

Your CPT must be available in the REST API, or it won’t work in the Block Editor.

If you’ve created your CPT in code, you can simply add this parameter as true:

add_action( 'init', 'register' );
function register() {
    register_post_type( 'portfolio', array(
    'label' => 'Portfolio',
    'public' => true,
    'show_in_rest' => true,
    'taxonomies'  => array( 'category', 'related_service' )
    ) );

If you’ve created your CPT with a plugin such as Custom Post Type UI, toggle the “Show in Rest API” setting to true.

Screen shot showing the "Show in REST API" setting set to True

The same fix applies for taxonomies that are not appearing in the Block Editor. Make sure they are shown in the REST API, and assigned to whatever post type you are editing, and they’ll appear in the Block Editor.

add_action( 'init', 'add_taxonomies' );    
function add_taxonomies() {
        'label' => 'Related Services',
        'public' => true,
        'show_in_rest' => true

Leave a Reply

Your email address will not be published. Required fields are marked *