返回介绍

taxonomy_exists()

发布于 2017-09-11 10:30:41 字数 4040 浏览 1037 评论 0 收藏 0

taxonomy_exists( string $taxonomy )

Checks that the taxonomy name exists.


description

Formerly is_taxonomy(), introduced in 2.3.0.


参数

$taxonomy

(string) (Required) Name of taxonomy object.


返回值

(bool) Whether the taxonomy exists.


源代码

File: wp-includes/taxonomy.php

function taxonomy_exists( $taxonomy ) {
	global $wp_taxonomies;

	return isset( $wp_taxonomies[$taxonomy] );
}

更新日志

Versiondescription
3.0.0Introduced.

相关函数

Used By

  • wp-includes/taxonomy.php: unregister_taxonomy()
  • wp-includes/class-wp-term.php: WP_Term::get_instance()
  • wp-includes/customize/class-wp-customize-nav-menu-item-setting.php: WP_Customize_Nav_Menu_Item_Setting::populate_value()
  • wp-admin/includes/class-wp-screen.php: WP_Screen::get()
  • wp-admin/includes/class-wp-terms-list-table.php: WP_Terms_List_Table::__construct()
  • wp-admin/includes/nav-menu.php: _wp_ajax_menu_quick_search()
  • wp-includes/category-template.php: wp_list_categories()
  • wp-includes/deprecated.php: is_taxonomy()
  • wp-includes/widgets/class-wp-widget-tag-cloud.php: WP_Widget_Tag_Cloud::_get_current_taxonomy()
  • wp-includes/class-wp-tax-query.php: WP_Tax_Query::clean_query()
  • wp-includes/taxonomy.php: wp_update_term()
  • wp-includes/taxonomy.php: wp_get_object_terms()
  • wp-includes/taxonomy.php: wp_insert_term()
  • wp-includes/taxonomy.php: wp_set_object_terms()
  • wp-includes/taxonomy.php: wp_remove_object_terms()
  • wp-includes/taxonomy.php: get_term_by()
  • wp-includes/taxonomy.php: get_term_children()
  • wp-includes/taxonomy.php: get_terms()
  • wp-includes/taxonomy.php: get_taxonomy()
  • wp-includes/taxonomy.php: is_taxonomy_hierarchical()
  • wp-includes/taxonomy.php: get_objects_in_term()
  • wp-includes/taxonomy.php: get_term()
  • wp-includes/link-template.php: get_adjacent_post()
  • wp-includes/link-template.php: get_boundary_post()
  • 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 25 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

    Basic Example

    
    $taxonomy_exist = taxonomy_exists( 'category' );
    // Returns true
    
    $taxonomy_exist = taxonomy_exists( 'post_tag' );
    // Returns true
    
    $taxonomy_exist = taxonomy_exists( 'link_category' );
    // Returns true
    
    $taxonomy_exist = taxonomy_exists( 'my_taxonomy' );
    // Returns false if global $wp_taxonomies['my_taxonomy'] is not set
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文