WP_Taxonomy
- Since
- 4.7.0
- Source
wp-includes/class-wp-taxonomy.php:15
Core class used for interacting with taxonomies.
Compatibility
- WordPress
- since 4.7.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 2
Every hook that fires from inside WP_Taxonomy, in the order it appears in the class, grouped by the method that fires it.
WP_Taxonomy::set_props()
- apply_filters( register_taxonomy_args )filter line 316
- apply_filters( register_{$taxonomy}_taxonomy_args )filter line 337
Properties · 30
$namestringpublic- Taxonomy key.
$labelstringpublic- Name of the taxonomy shown in the menu. Usually plural.
$labelsstdClasspublic- Labels object for this taxonomy.
$default_labels(string|null)[][]protected static- Default labels.
$descriptionstringpublic- A short descriptive summary of what the taxonomy is for.
$publicboolpublic- Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users.
$publicly_queryableboolpublic- Whether the taxonomy is publicly queryable.
$hierarchicalboolpublic- Whether the taxonomy is hierarchical.
$show_uiboolpublic- Whether to generate and allow a UI for managing terms in this taxonomy in the admin.
$show_tagcloudboolpublic- Whether to list the taxonomy in the tag cloud widget controls.
$show_in_quick_editboolpublic- Whether to show the taxonomy in the quick/bulk edit panel.
$show_admin_columnboolpublic- Whether to display a column for the taxonomy on its post type listing screens.
$meta_box_cbbool|callablepublic- The callback function for the meta box display.
$meta_box_sanitize_cbcallablepublic- The callback function for sanitizing taxonomy data saved from a meta box.
$object_typestring[]public- An array of object types this taxonomy is registered for.
$capstdClasspublic- Capabilities for this taxonomy.
$rewritearray|falsepublic- Rewrites information for this taxonomy.
$query_varstring|falsepublic- Query var string for this taxonomy.
$update_count_callbackcallablepublic- Function that will be called when the count is updated.
$show_in_restboolpublic- Whether this taxonomy should appear in the REST API.
$rest_basestring|boolpublic- The base path for this taxonomy's REST API endpoints.
$rest_namespacestring|boolpublic- The namespace for this taxonomy's REST API endpoints.
$rest_controller_classstring|boolpublic- The controller for this taxonomy's REST API endpoints.
$rest_controllerWP_REST_Controllerpublic- The controller instance for this taxonomy's REST API endpoints.
$default_termarray|stringpublic- The default term name for this taxonomy. If you pass an array you have to set 'name' and optionally 'slug' and 'description'.
$sortbool|nullpublic- Whether terms in this taxonomy should be sorted in the order they are provided to
wp_set_object_terms(). $argsarray|nullpublic- Array of arguments to automatically use inside
wp_get_object_terms()for this taxonomy. $_builtinboolpublic- Whether it is a built-in taxonomy.
Methods · 9
- __construct()Constructor.
- set_props()Sets taxonomy properties.
- add_rewrite_rules()Adds the necessary rewrite rules for the taxonomy.
- remove_rewrite_rules()Removes any rewrite rules, permastructs, and rules for the taxonomy.
- add_hooks()Registers the ajax callback for the meta box.
- remove_hooks()Removes the ajax callback for the meta box.
- get_rest_controller()Gets the REST API controller for this taxonomy.
- get_default_labels()Returns the default labels for taxonomies.
- reset_default_labels()Resets the cache for the default labels.
Source code
#[AllowDynamicProperties]final class WP_Taxonomy { /** * Taxonomy key. * * @since 4.7.0 * @var string */ public $name; /** * Name of the taxonomy shown in the menu. Usually plural. * * @since 4.7.0 * @var string */ public $label; /** * Labels object for this taxonomy. * * If not set, tag labels are inherited for non-hierarchical types * and category labels for hierarchical ones. * * @see get_taxonomy_labels() * * @since 4.7.0 * @var stdClass */ public $labels; /** * Default labels. * * @since 6.0.0 * @var (string|null)[][] $default_labels */ protected static $default_labels = array(); /** * A short descriptive summary of what the taxonomy is for. * * @since 4.7.0 * @var string */ public $description = ''; /** * Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users. * * @since 4.7.0 * @var bool */ public $public = true; /** * Whether the taxonomy is publicly queryable. * * @since 4.7.0 * @var bool */ public $publicly_queryable = true; /** * Whether the taxonomy is hierarchical. * * @since 4.7.0 * @var bool */ public $hierarchical = false; /** * Whether to generate and allow a UI for managing terms in this taxonomy in the admin. * * @since 4.7.0 * @var bool */ public $show_ui = true; /**Changelog
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-includes/class-wp-taxonomy.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.