Using Meta data in a CPT

To make use of meta data in a Custom Post Type remember that custom-fields needs to be set in the supports property of the register_post_type function.

To activate the Gutenberg/Block editor in a Custom Post Type editor needs to be set in the supports property. show_in_rest also needs to be set to true.

register_post_type( 'my_cpt', array(
	'show_in_rest' => true,
	'supports'     => array(
		'custom-fields',
		'editor',
	),
	// ...
);
PHP