Skip to content

Overview of Custom Post Types Model

Carlos Moreira edited this page Jun 1, 2020 · 1 revision

The model for a Custom Post Type will define how it will behave and what features it will have.

Example:

return [
	'type'         => 'cpt',
	'active'       => true,
	'name'         => 'book',
	'block_editor' => false,
	'features'     => [],
	'supports'     => [],
	'labels'       => [],
	'options'      => [],
	'meta'         => [],
	'settings'     => [],
];

Available parameters and description:

Parameter Description
active boolean - sets this model to active or inactive
type string - type of model
name string - identifier of the custom post type
block_editor boolean - if the Block Editor should be enabled or not
features array - Features that this CPT will support (More Info Soon)
supports array - refer to the supports argument of the register_post_type function from WordPress
labels array - Everything related with labels for this custom post type (More Info Soon)
options array - Refer to the second argument in the register_post_type function from WordPress
meta array - Information for the Metaboxes for this CPT (More Info Soon)
settings array - Information for the Settings page of this CPT (More Info Soon)