A plugin creates the custom post type ‘dlp_document’. This supports taxonomies and tags. I use GenerateBlocks. In the query loop block, the custom post type ‘dlp_document’ is not listed.
In the plugin’s code I found the registration of the custom post type. I changed the value ‘show_in_rest’ to ‘true’ manually as a test. Then it works.
What do I have to put in the function.php for this change?
const POST_TYPE_SLUG = 'dlp_document';
public function register() {
add_action( 'init', [ $this, 'register_post_type' ], 15 );
add_action( 'init', [ $this, 'flush_rewrite_rules' ], 16 );
}
/**
* Register the Document post type.
*/
public function register_post_type() {
$labels = [
'name' => _x( 'Documents', 'Post Type General Name', 'document-library-pro' ),
'singular_name' => _x( 'Document', 'Post Type Singular Name', 'document-library-pro' ),
'menu_position' => 26,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'hierarchical' => false,
'exclude_from_search' => false,
'show_in_rest' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'rewrite' => [ 'slug' => $this->document_slug ],
];
register_post_type( self::POST_TYPE_SLUG, $args );
}