-
Notifications
You must be signed in to change notification settings - Fork 1
Options parameter for Custom Post Type Model
Carlos Moreira edited this page Jun 2, 2020
·
2 revisions
Your model might contain the options parameter.
This argument accepts an array with the same options available for the second parameter of the register_post_type function from WordPress described in their documentation as the $args parameter.
Example:
return [
'active' => true,
'type' => 'cpt',
'name' => 'book',
'options' => [
'public' => true,
'publicly_queryable' => true,
'show_in_rest' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'can_export' => true,
'capability_type' => 'post',
'menu_icon' => 'dashicons-book',
'rewrite' => [
'slug' => 'book',
'with_front' => true,
'feeds' => true,
'pages' => true,
],
],
];
This controls multiple aspects of your Custom Post Type. The supports, label and labels parameters can also be controlled using other Saltus Model parameters.