Filters the arguments for registering a taxonomy.
Parameters
$args
array- Array of arguments for registering a taxonomy.
See the register_taxonomy() function for accepted arguments.More Arguments from register_taxonomy( … $args )
Array or query string of arguments for registering a taxonomy.
labels
string[]An array of labels for this taxonomy. By default, Tag labels are used for non-hierarchical taxonomies, and Category labels are used for hierarchical taxonomies. See accepted values in get_taxonomy_labels() .description
stringA short descriptive summary of what the taxonomy is for.public
boolWhether a taxonomy is intended for use publicly either via the admin interface or by front-end users. The default settings of$publicly_queryable
,$show_ui
, and$show_in_nav_menus
are inherited from$public
.publicly_queryable
boolWhether the taxonomy is publicly queryable.
If not set, the default is inherited from$public
hierarchical
boolWhether the taxonomy is hierarchical. Default false.show_ui
boolWhether to generate and allow a UI for managing terms in this taxonomy in the admin. If not set, the default is inherited from$public
(default true).show_in_menu
boolWhether to show the taxonomy in the admin menu. If true, the taxonomy is shown as a submenu of the object type menu. If false, no menu is shown.
$show_ui
must be true. If not set, default is inherited from$show_ui
(default true).show_in_nav_menus
boolMakes this taxonomy available for selection in navigation menus. If not set, the default is inherited from$public
(default true).show_in_rest
boolWhether to include the taxonomy in the REST API. Set this to true for the taxonomy to be available in the block editor.rest_base
stringTo change the base url of REST API route. Default is $taxonomy.rest_namespace
stringTo change the namespace URL of REST API route. Default is wp/v2.rest_controller_class
stringREST API Controller class name. Default is ‘WP_REST_Terms_Controller‘.show_tagcloud
boolWhether to list the taxonomy in the Tag Cloud Widget controls. If not set, the default is inherited from$show_ui
(default true).show_in_quick_edit
boolWhether to show the taxonomy in the quick/bulk edit panel. It not set, the default is inherited from$show_ui
(default true).show_admin_column
boolWhether to display a column for the taxonomy on its post type listing screens. Default false.meta_box_cb
bool|callableProvide a callback function for the meta box display. If not set, post_categories_meta_box() is used for hierarchical taxonomies, and post_tags_meta_box() is used for non-hierarchical. If false, no meta box is shown.meta_box_sanitize_cb
callableCallback function for sanitizing taxonomy data saved from a meta box. If no callback is defined, an appropriate one is determined based on the value of$meta_box_cb
.capabilities
string[]Array of capabilities for this taxonomy.manage_terms
stringDefault'manage_categories'
.edit_terms
stringDefault'manage_categories'
.delete_terms
stringDefault'manage_categories'
.assign_terms
stringDefault'edit_posts'
.
rewrite
bool|arrayTriggers the handling of rewrites for this taxonomy. Default true, using $taxonomy as slug. To prevent rewrite, set to false. To specify rewrite rules, an array can be passed with any of these keys:slug
stringCustomize the permastruct slug. Default$taxonomy
key.with_front
boolShould the permastruct be prepended with WP_Rewrite::$front. Default true.hierarchical
boolEither hierarchical rewrite tag or not. Default false.ep_mask
intAssign an endpoint mask. DefaultEP_NONE
.
query_var
string|boolSets the query var key for this taxonomy. Default$taxonomy
key. If false, a taxonomy cannot be loaded at?{query_var}={term_slug}
. If a string, the query?{query_var}={term_slug}
will be valid.update_count_callback
callableWorks much like a hook, in that it will be called when the count is updated. Default _update_post_term_count() for taxonomies attached to post types, which confirms that the objects are published before counting them. Default _update_generic_term_count() for taxonomies attached to other object types, such as users.default_term
string|arrayDefault term to be used for the taxonomy.name
stringName of default term.slug
stringSlug for default term.description
stringDescription for default term.
sort
boolWhether terms in this taxonomy should be sorted in the order they are provided towp_set_object_terms()
. Default null which equates to false.args
arrayArray of arguments to automatically use insidewp_get_object_terms()
for this taxonomy._builtin
boolThis taxonomy is a "built-in" taxonomy. INTERNAL USE ONLY! Default false.
$taxonomy
stringTaxonomy key.$object_type
string[]Array of names of object types for the taxonomy.Source
$args = apply_filters( 'register_taxonomy_args', $args, $this->name, (array) $object_type );
Changelog
Version Description 4.4.0 Introduced. User Contributed Notes
You must log in before being able to contribute a note or feedback.
Usage example: