“Unlocking Hidden Potential: How WordPress Can Transform Your Data Entry into a Powerful Central API!”
The simplest way to disable Gutenberg support for a CPT is to set the show_in_rest
argument to false
when registering it (as we’ve done above).
Alternatively, if you want to keep the built-in REST routes that WordPress provides for every CPT, you can add this code to your child theme:
/**
* Disables the block editor for certain CPTs.
*/
add_filter(
'use_block_editor_for_post_type',
static function( bool $use_block_editor, string $post_type ): bool {
if ( in_array( $post_type, array( 'employee', 'office' ), true ) ) {
$use_block_editor = false;
}
return $use_block_editor;
},
10,
2
);
Custom Fields
Now that we have our basic data types in place, we need to start populating them with entries. Before we do that, we need to ensure that we can record all the necessary data on each entry, and for that we will need to build custom fields.
Post Comment