get_taxonomy() - WordPress 函数参考中文文档

返回介绍

get_taxonomy()

发布于 2017-09-11 字数10329 浏览 787 评论 0

get_taxonomy( string $taxonomy )

Retrieves the taxonomy object of $taxonomy.


描述

The get_taxonomy function will first check that the parameter string given is a taxonomy object and if it is, it will return it.


参数

$taxonomy

(string)
(Required)
Name of taxonomy object to return.


返回值

(WP_Taxonomy|false) The Taxonomy Object or false if $taxonomy doesn’t exist.


源代码

File: wp-includes/taxonomy.php

function get_taxonomy( $taxonomy ) {
	global $wp_taxonomies;

	if ( ! taxonomy_exists( $taxonomy ) )
		return false;

	return $wp_taxonomies[$taxonomy];
}

更新日志

Version 描述
2.3.0 Introduced.

相关函数

Uses

  • wp-includes/taxonomy.php:
    taxonomy_exists()

Used By

  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::check_is_taxonomy_allowed()
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::prepare_links()
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::get_item_schema()
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::get_collection_params()
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::create_item_permissions_check()
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::__construct()
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::get_items_permissions_check()
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:
    WP_REST_Terms_Controller::get_items()
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:
    WP_REST_Posts_Controller::prepare_links()
  • wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php:
    WP_REST_Taxonomies_Controller::get_item_permissions_check()
  • wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php:
    WP_REST_Taxonomies_Controller::get_item()
  • wp-includes/customize/class-wp-customize-nav-menu-item-setting.php:
    WP_Customize_Nav_Menu_Item_Setting::get_type_label()
  • wp-admin/includes/class-wp-posts-list-table.php:
    WP_Posts_List_Table::categories_dropdown()
  • wp-includes/taxonomy.php:
    unregister_taxonomy()
  • wp-includes/class-wp-customize-nav-menus.php:
    WP_Customize_Nav_Menus::search_available_items_query()
  • wp-includes/class-wp-customize-nav-menus.php:
    WP_Customize_Nav_Menus::load_available_items_query()
  • wp-admin/includes/class-wp-posts-list-table.php:
    WP_Posts_List_Table::column_default()
  • wp-admin/includes/class-wp-terms-list-table.php:
    WP_Terms_List_Table::handle_row_actions()
  • wp-admin/includes/class-wp-media-list-table.php:
    WP_Media_List_Table::column_default()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::html()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::add_category()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::categories_html()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::tags_html()
  • wp-admin/includes/class-wp-press-this.php:
    WP_Press_This::save_post()
  • wp-admin/includes/class-wp-terms-list-table.php:
    WP_Terms_List_Table::no_items()
  • wp-includes/general-template.php:
    get_the_archive_title()
  • wp-admin/includes/class-wp-links-list-table.php:
    WP_Links_List_Table::extra_tablenav()
  • wp-admin/includes/template.php:
    get_inline_data()
  • wp-admin/includes/template.php:
    wp_terms_checklist()
  • wp-admin/includes/template.php:
    wp_popular_terms_checklist()
  • wp-admin/includes/media.php:
    get_attachment_fields_to_edit()
  • wp-admin/includes/media.php:
    get_compat_media_markup()
  • wp-admin/includes/post.php:
    _wp_translate_postdata()
  • wp-admin/includes/post.php:
    bulk_edit_posts()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_inline_save()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_inline_save_tax()
  • wp-admin/includes/ajax-actions.php:
    _wp_ajax_add_hierarchical_term()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_add_link_category()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_add_tag()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_get_tagcloud()
  • wp-admin/includes/ajax-actions.php:
    wp_ajax_ajax_tag_search()
  • wp-admin/includes/meta-boxes.php:
    post_tags_meta_box()
  • wp-admin/includes/meta-boxes.php:
    post_categories_meta_box()
  • 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()
  • wp-admin/includes/class-wp-terms-list-table.php:
    WP_Terms_List_Table::__construct()
  • 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/class-wp-posts-list-table.php:
    WP_Posts_List_Table::inline_edit()
  • wp-admin/includes/class-wp-posts-list-table.php:
    WP_Posts_List_Table::get_columns()
  • wp-includes/capabilities.php:
    map_meta_cap()
  • wp-includes/category-template.php:
    wp_list_categories()
  • wp-includes/general-template.php:
    feed_links_extra()
  • wp-includes/general-template.php:
    wp_title()
  • wp-includes/widgets/class-wp-widget-tag-cloud.php:
    WP_Widget_Tag_Cloud::widget()
  • wp-includes/taxonomy.php:
    _pad_term_counts()
  • wp-includes/taxonomy.php:
    get_term_link()
  • wp-includes/taxonomy.php:
    get_the_taxonomies()
  • wp-includes/taxonomy.php:
    wp_update_term_count_now()
  • wp-includes/taxonomy.php:
    wp_get_object_terms()
  • wp-includes/taxonomy.php:
    wp_set_object_terms()
  • wp-includes/taxonomy.php:
    wp_delete_term()
  • wp-includes/taxonomy.php:
    is_taxonomy_hierarchical()
  • wp-includes/link-template.php:
    get_term_feed_link()
  • wp-includes/link-template.php:
    get_edit_term_link()
  • wp-includes/link-template.php:
    edit_term_link()
  • wp-includes/admin-bar.php:
    wp_admin_bar_edit_menu()
  • wp-includes/post.php:
    wp_insert_post()
  • wp-includes/canonical.php:
    redirect_canonical()
  • wp-includes/post-formats.php:
    _post_format_request()
  • wp-includes/nav-menu.php:
    wp_setup_nav_menu_item()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_newTerm()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_editTerm()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_deleteTerm()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getTerm()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getTerms()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::wp_getTaxonomy()
  • Show 73 more used by
    Hide more used by


User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    For example for a custom taxonomy named “features” associated with a custom post type named “rentals”.

    
    $rental_features = get_taxonomy( 'features' );
    print_r( $rental_features );
    

    Result:

    
    stdClass Object ( 
    	[hierarchical] => 
    	[update_count_callback] => 
    	[rewrite] => 
    		Array ( [slug] => features [with_front] => 1 ) 
    	[query_var] => features 
    	[public] => 1 
    	[show_ui] => 1 
    	[show_tagcloud] => 1 
    	[_builtin] => 
    	[labels] => 
    		stdClass Object ( 
    			[name] => Features 
    			[singular_name] => Feature 
    			[search_items] => Search Features 
    			[popular_items] => Popular Features 
    			[all_items] => All Features 
    			[parent_item] => Parent Feature 
    			[parent_item_colon] => Parent Feature: 
    			[edit_item] => Edit Feature 
    			[update_item] => Update Feature 
    			[add_new_item] => Add New Feature 
    			[new_item_name] => New Feature Name 
    			[separate_items_with_commas] => Separate Features with commas 
    			[add_or_remove_items] => Add or remove Features 
    			[choose_from_most_used] => Choose from the most used Features 
    		) 
    	[show_in_nav_menus] => 1 
    	[label] => Features 
    	[singular_label] => Feature 
    	[cap] => 
    		stdClass Object ( 
    			[manage_terms] => manage_categories 
    			[edit_terms] => manage_categories 
    			[delete_terms] => manage_categories 
    			[assign_terms] => edit_posts 
    		) 
    	[name] => features 
    	[object_type] => 
    		Array ( [0] => rentals [1] => rentals ) 
    	)
    

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!