121 * will be placed as a sub-menu of that. |
121 * will be placed as a sub-menu of that. |
122 * |
122 * |
123 * Default is the value of $show_ui. |
123 * Default is the value of $show_ui. |
124 * |
124 * |
125 * @since 4.6.0 |
125 * @since 4.6.0 |
126 * @var bool $show_in_menu |
126 * @var bool|string $show_in_menu |
127 */ |
127 */ |
128 public $show_in_menu = null; |
128 public $show_in_menu = null; |
129 |
129 |
130 /** |
130 /** |
131 * Makes this post type available for selection in navigation menus. |
131 * Makes this post type available for selection in navigation menus. |
156 * @var int $menu_position |
156 * @var int $menu_position |
157 */ |
157 */ |
158 public $menu_position = null; |
158 public $menu_position = null; |
159 |
159 |
160 /** |
160 /** |
161 * The URL to the icon to be used for this menu. |
161 * The URL or reference to the icon to be used for this menu. |
162 * |
162 * |
163 * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme. |
163 * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme. |
164 * This should begin with 'data:image/svg+xml;base64,'. Pass the name of a Dashicons helper class |
164 * This should begin with 'data:image/svg+xml;base64,'. Pass the name of a Dashicons helper class |
165 * to use a font icon, e.g. 'dashicons-chart-pie'. Pass 'none' to leave div.wp-menu-image empty |
165 * to use a font icon, e.g. 'dashicons-chart-pie'. Pass 'none' to leave div.wp-menu-image empty |
166 * so an icon can be added via CSS. |
166 * so an icon can be added via CSS. |
248 public $can_export = true; |
248 public $can_export = true; |
249 |
249 |
250 /** |
250 /** |
251 * Whether to delete posts of this type when deleting a user. |
251 * Whether to delete posts of this type when deleting a user. |
252 * |
252 * |
253 * If true, posts of this type belonging to the user will be moved to Trash when then user is deleted. |
253 * - If true, posts of this type belonging to the user will be moved to Trash when the user is deleted. |
254 * If false, posts of this type belonging to the user will *not* be trashed or deleted. |
254 * - If false, posts of this type belonging to the user will *not* be trashed or deleted. |
255 * If not set (the default), posts are trashed if post_type_supports( 'author' ). |
255 * - If not set (the default), posts are trashed if post type supports the 'author' feature. |
256 * Otherwise posts are not trashed or deleted. Default null. |
256 * Otherwise posts are not trashed or deleted. |
|
257 * |
|
258 * Default null. |
257 * |
259 * |
258 * @since 4.6.0 |
260 * @since 4.6.0 |
259 * @var bool $delete_with_user |
261 * @var bool $delete_with_user |
260 */ |
262 */ |
261 public $delete_with_user = null; |
263 public $delete_with_user = null; |
262 |
264 |
263 /** |
265 /** |
|
266 * Array of blocks to use as the default initial state for an editor session. |
|
267 * |
|
268 * Each item should be an array containing block name and optional attributes. |
|
269 * |
|
270 * Default empty array. |
|
271 * |
|
272 * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/ |
|
273 * |
|
274 * @since 5.0.0 |
|
275 * @var array $template |
|
276 */ |
|
277 public $template = array(); |
|
278 |
|
279 /** |
|
280 * Whether the block template should be locked if $template is set. |
|
281 * |
|
282 * - If set to 'all', the user is unable to insert new blocks, move existing blocks |
|
283 * and delete blocks. |
|
284 * - If set to 'insert', the user is able to move existing blocks but is unable to insert |
|
285 * new blocks and delete blocks. |
|
286 * |
|
287 * Default false. |
|
288 * |
|
289 * @link https://developer.wordpress.org/block-editor/developers/block-api/block-templates/ |
|
290 * |
|
291 * @since 5.0.0 |
|
292 * @var string|false $template_lock |
|
293 */ |
|
294 public $template_lock = false; |
|
295 |
|
296 /** |
264 * Whether this post type is a native or "built-in" post_type. |
297 * Whether this post type is a native or "built-in" post_type. |
265 * |
298 * |
266 * Default false. |
299 * Default false. |
267 * |
300 * |
268 * @since 4.6.0 |
301 * @since 4.6.0 |
379 * Filters the arguments for registering a post type. |
416 * Filters the arguments for registering a post type. |
380 * |
417 * |
381 * @since 4.4.0 |
418 * @since 4.4.0 |
382 * |
419 * |
383 * @param array $args Array of arguments for registering a post type. |
420 * @param array $args Array of arguments for registering a post type. |
|
421 * See the register_post_type() function for accepted arguments. |
384 * @param string $post_type Post type key. |
422 * @param string $post_type Post type key. |
385 */ |
423 */ |
386 $args = apply_filters( 'register_post_type_args', $args, $this->name ); |
424 $args = apply_filters( 'register_post_type_args', $args, $this->name ); |
387 |
425 |
388 $has_edit_link = ! empty( $args['_edit_link'] ); |
426 $has_edit_link = ! empty( $args['_edit_link'] ); |
413 'can_export' => true, |
451 'can_export' => true, |
414 'delete_with_user' => null, |
452 'delete_with_user' => null, |
415 'show_in_rest' => false, |
453 'show_in_rest' => false, |
416 'rest_base' => false, |
454 'rest_base' => false, |
417 'rest_controller_class' => false, |
455 'rest_controller_class' => false, |
|
456 'template' => array(), |
|
457 'template_lock' => false, |
418 '_builtin' => false, |
458 '_builtin' => false, |
419 '_edit_link' => 'post.php?post=%d', |
459 '_edit_link' => 'post.php?post=%d', |
420 ); |
460 ); |
421 |
461 |
422 $args = array_merge( $defaults, $args ); |
462 $args = array_merge( $defaults, $args ); |