0

It is an old site made before the new block editor arrives. Now it's running WP 5.0.11, and I do not want to make an upgrade right now for various reasons.

The default post types are using the new block editor, but the custom post type still use the old TinyMCE and I even cannot insert images to it. The image problem wold not be a problem if I could switch to the block editor witch works.

Thank you in advance.

2
  • does the classic editor plugin not work for you? Your root problem is the out of date WordPress version, you need to resolve your other issues and update
    – Tom J Nowell
    Commented Dec 24, 2020 at 10:23
  • As I mentioned the block editor is working in default post type, but in custom post type not. Commented Dec 24, 2020 at 10:31

1 Answer 1

2

In your code where you defined your custom post type (in a custom plugin or in your functions.phpfile), you need to add this snippet for Gutenberg block editor support:

'show_in_rest' => true,
   'supports' => array('editor')

Here is an example:

function portfolio_post_type() {
    register_post_type( 'portfolio',
        array(
            'labels' => array(
                'name' => __( 'Portfolio' ),
                'singular_name' => __( 'Portfolio' )
            ),
            'has_archive' => true,
            'public' => true,
            'rewrite' => array('slug' => 'portfolio'),
            'show_in_rest' => true,
            'supports' => array('editor')
        )
    );
}
 
add_action( 'init', 'portfolio_post_type' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.