You have to declare that your custom post type supports the editor
, and have show_in_rest
set to true when registering the post type.
Here is what the official dev hub says about supports
:
‘supports’
(array) Core feature(s) the post type supports. Serves as an alias for calling add_post_type_support() directly. Core features include ‘title’, ‘editor’, ‘comments’, ‘revisions’, ‘trackbacks’, ‘author’, ‘excerpt’, ‘page-attributes’, ‘thumbnail’, ‘custom-fields’, and ‘post-formats’. Additionally, the ‘revisions’ feature dictates whether the post type will store revisions, and the ‘comments’ feature dictates whether the comments count will show on the edit screen. A feature can also be specified as an array of arguments to provide additional information about supporting that feature. Example: array( ‘my_feature’, array( ‘field’ => ‘value’ ) ). Default is an array containing ‘title’ and ‘editor’.
If you don’t, then WordPress will fall back to the classic editor