Filter
rpress_fooditem_post_type_args
On this page
Filters the arguments used to register the fooditem (menu item) post type.
Runs just before register_post_type( 'fooditem' ). The default array contains labels, public (false), show_ui, show_in_menu, query_var, rewrite (false), capability_type ('product'), map_meta_cap, publicly_queryable (false), has_archive (false), hierarchical (false) and supports. Use it to change how the post type is registered, for example to expose it in the REST API.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$fooditem_args | array | Arguments for register_post_type(). |
Return value#
array. The registration arguments.
Example#
add_filter( 'rpress_fooditem_post_type_args', 'my_fooditem_rest_args', 10, 1 );
function my_fooditem_rest_args( $fooditem_args ) {
$fooditem_args['show_in_rest'] = true;
return $fooditem_args;
}
Notes#
Menu items are not publicly queryable by default, so changing the public-facing arguments can have side effects on the front end.
Source#
Applied in:
includes/post-types.php(line 63), inrpress_setup_rpress_post_types()
See also#
Was this page helpful?
