get_taxonomy() WordPress Function
The get_taxonomy() function is used to retrieve information about a given taxonomy. This function can be used to get information about both built-in taxonomies (such as categories and tags) and custom taxonomies. The get_taxonomy() function takes a single parameter, the name of the taxonomy, and returns an object containing information about the taxonomy.
get_taxonomy( string $taxonomy ) #
Retrieves the taxonomy object of $taxonomy.
Description
The get_taxonomy function will first check that the parameter string given is a taxonomy object and if it is, it will return it.
Parameters
- $taxonomy
(string)(Required)Name of taxonomy object to return.
Return
(WP_Taxonomy|false) The taxonomy object or false if $taxonomy doesn't exist.
More Information
Note that it does NOT return the list of terms associated with the taxonomy. To do this, you should use get_term() to return an object or wp_list_categories() to return an HTML list of terms
Source
File: wp-includes/taxonomy.php
function get_taxonomy( $taxonomy ) { global $wp_taxonomies; if ( ! taxonomy_exists( $taxonomy ) ) { return false; } return $wp_taxonomies[ $taxonomy ]; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Related
Uses
Uses | Description |
---|---|
wp-includes/taxonomy.php:taxonomy_exists() | Determines whether the taxonomy name exists. |
Used By
Used By | Description |
---|---|
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php:WP_REST_Menu_Items_Controller::prepare_item_for_database() | Prepares a single post for create or update. |
wp-includes/rest-api.php:rest_get_route_for_taxonomy_items() | Gets the REST API route for a taxonomy. |
wp-includes/taxonomy.php:is_taxonomy_viewable() | Determines whether a taxonomy is considered “viewable”. |
wp-admin/includes/meta-boxes.php:register_and_do_post_meta_boxes() | Registers the default post meta boxes, and runs the |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::check_is_taxonomy_allowed() | Checks that the taxonomy is valid. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::get_item_schema() | Retrieves the term’s schema, conforming to JSON Schema. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::get_collection_params() | Retrieves the query params for collections. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::create_item_permissions_check() | Checks if a request has access to create a term. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::__construct() | Constructor. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::get_items_permissions_check() | Checks if a request has access to read terms in the specified taxonomy. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:WP_REST_Terms_Controller::get_items() | Retrieves terms associated with a taxonomy. |
wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php:WP_REST_Taxonomies_Controller::get_item_permissions_check() | Checks if a given request has access to a taxonomy. |
wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php:WP_REST_Taxonomies_Controller::get_item() | Retrieves a specific taxonomy. |
wp-includes/customize/class-wp-customize-nav-menu-item-setting.php:WP_Customize_Nav_Menu_Item_Setting::get_type_label() | Get type label. |
wp-admin/includes/class-wp-posts-list-table.php:WP_Posts_List_Table::categories_dropdown() | Displays a categories drop-down for filtering on the Posts list table. |
wp-includes/taxonomy.php:unregister_taxonomy() | Unregisters a taxonomy. |
wp-includes/class-wp-customize-nav-menus.php:WP_Customize_Nav_Menus::search_available_items_query() | Performs post queries for available-item searching. |
wp-includes/class-wp-customize-nav-menus.php:WP_Customize_Nav_Menus::load_available_items_query() | Performs the post_type and taxonomy queries for loading available menu items. |
wp-admin/includes/class-wp-posts-list-table.php:WP_Posts_List_Table::column_default() | Handles the default column output. |
wp-admin/includes/class-wp-terms-list-table.php:WP_Terms_List_Table::handle_row_actions() | Generates and displays row action links. |
wp-admin/includes/class-wp-media-list-table.php:WP_Media_List_Table::column_default() | Handles output for the default column. |
wp-admin/includes/class-wp-terms-list-table.php:WP_Terms_List_Table::no_items() | |
wp-includes/general-template.php:get_the_archive_title() | Retrieve the archive title based on the queried object. |
wp-admin/includes/class-wp-links-list-table.php:WP_Links_List_Table::extra_tablenav() | |
wp-admin/includes/template.php:get_inline_data() | Adds hidden fields with the data for use in the inline editor for posts and pages. |
wp-admin/includes/template.php:wp_terms_checklist() | Outputs an unordered list of checkbox input elements labelled with term names. |
wp-admin/includes/template.php:wp_popular_terms_checklist() | Retrieves a list of the most popular terms from the specified taxonomy. |
wp-admin/includes/media.php:get_attachment_fields_to_edit() | Retrieves the attachment fields to edit form fields. |
wp-admin/includes/media.php:get_compat_media_markup() | |
wp-admin/includes/post.php:_wp_translate_postdata() | Renames |
wp-admin/includes/post.php:edit_post() | Updates an existing post with values provided in |
wp-admin/includes/post.php:bulk_edit_posts() | Processes the post data for the bulk editing of posts. |
wp-admin/includes/ajax-actions.php:wp_ajax_inline_save() | Ajax handler for Quick Edit saving a post from a list table. |
wp-admin/includes/ajax-actions.php:wp_ajax_inline_save_tax() | Ajax handler for quick edit saving for a term. |
wp-admin/includes/ajax-actions.php:_wp_ajax_add_hierarchical_term() | Ajax handler for adding a hierarchical term. |
wp-admin/includes/ajax-actions.php:wp_ajax_add_link_category() | Ajax handler for adding a link category. |
wp-admin/includes/ajax-actions.php:wp_ajax_add_tag() | Ajax handler to add a tag. |
wp-admin/includes/ajax-actions.php:wp_ajax_get_tagcloud() | Ajax handler for getting a tagcloud. |
wp-admin/includes/ajax-actions.php:wp_ajax_ajax_tag_search() | Ajax handler for tag search. |
wp-admin/includes/meta-boxes.php:post_tags_meta_box() | Displays post tags form fields. |
wp-admin/includes/meta-boxes.php:post_categories_meta_box() | Displays post categories form fields. |
wp-admin/includes/class-wp-media-list-table.php:WP_Media_List_Table::get_columns() | |
wp-admin/includes/class-wp-terms-list-table.php:WP_Terms_List_Table::column_posts() | |
wp-admin/includes/class-wp-terms-list-table.php:WP_Terms_List_Table::inline_edit() | Outputs the hidden row displayed when inline editing |
wp-admin/includes/class-wp-terms-list-table.php:WP_Terms_List_Table::__construct() | Constructor. |
wp-admin/includes/class-wp-terms-list-table.php:WP_Terms_List_Table::ajax_user_can() | |
wp-admin/includes/class-wp-terms-list-table.php:WP_Terms_List_Table::get_bulk_actions() | |
wp-admin/includes/nav-menu.php:wp_nav_menu_item_taxonomy_meta_box() | Displays a meta box for a taxonomy menu item. |
wp-admin/includes/class-wp-posts-list-table.php:WP_Posts_List_Table::inline_edit() | Outputs the hidden row displayed when inline editing |
wp-admin/includes/class-wp-posts-list-table.php:WP_Posts_List_Table::get_columns() | |
wp-includes/capabilities.php:map_meta_cap() | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
wp-includes/category-template.php:wp_list_categories() | Displays or retrieves the HTML list of categories. |
wp-includes/general-template.php:feed_links_extra() | Display the links to the extra feeds such as category feeds. |
wp-includes/general-template.php:wp_title() | Display or retrieve page title for all areas of blog. |
wp-includes/widgets/class-wp-widget-tag-cloud.php:WP_Widget_Tag_Cloud::widget() | Outputs the content for the current Tag Cloud widget instance. |
wp-includes/taxonomy.php:_pad_term_counts() | Adds count of children to parent count. |
wp-includes/taxonomy.php:get_term_link() | Generates a permalink for a taxonomy term archive. |
wp-includes/taxonomy.php:get_the_taxonomies() | Retrieves all taxonomies associated with a post. |
wp-includes/taxonomy.php:wp_update_term_count_now() | Performs term count update immediately. |
wp-includes/taxonomy.php:wp_get_object_terms() | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
wp-includes/taxonomy.php:wp_set_object_terms() | Creates term and taxonomy relationships. |
wp-includes/taxonomy.php:wp_delete_term() | Removes a term from the database. |
wp-includes/taxonomy.php:is_taxonomy_hierarchical() | Determines whether the taxonomy object is hierarchical. |
wp-includes/link-template.php:get_term_feed_link() | Retrieves the feed link for a term. |
wp-includes/link-template.php:get_edit_term_link() | Retrieves the URL for editing a given term. |
wp-includes/link-template.php:edit_term_link() | Displays or retrieves the edit term link with formatting. |
wp-includes/admin-bar.php:wp_admin_bar_edit_menu() | Provides an edit link for posts and terms. |
wp-includes/post.php:wp_insert_post() | Insert or update a post. |
wp-includes/canonical.php:redirect_canonical() | Redirects incoming links to the proper URL based on the site url. |
wp-includes/post-formats.php:_post_format_request() | Filters the request to allow for the format prefix. |
wp-includes/nav-menu.php:wp_setup_nav_menu_item() | Decorates a menu item object with the shared navigation menu item properties. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_newTerm() | Create a new term. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_editTerm() | Edit a term. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_deleteTerm() | Delete a term. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_getTerm() | Retrieve a term. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_getTerms() | Retrieve all terms for a taxonomy. |
wp-includes/class-wp-xmlrpc-server.php:wp_xmlrpc_server::wp_getTaxonomy() | Retrieve a taxonomy. |
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |