taxonomy_exists

Sponsored Link

この条件タグは、それへ引数としてタクソノミー名を渡すことでタクソノミー名が存在している場合にチェックします。これはboolean関数がタクソノミー名が存在する場合にチェックするために、グローバル$wp_taxonomies変数を使用して、タクソノミー名が存在する場合はTRUEあるいはタクソノミ名が存在しない場合はFALSEのいづれかを返すことを意味しています。

This Conditional Tag checks if the taxonomy name exists by passing a taxonomy name as an argument to it. This is a boolean function uses a global $wp_taxonomies variable for checking if taxonomy name existence, meaning it returns either TRUE if the taxonomy name exist or FALSE if it doesn’t exist.

taxonomy_existsのファンクションタグ使用方法

<?php taxonomy_exists($taxonomy); ?>

taxonomy_existsのパラメーター

$taxonomy

(string) (required)タクソノミーの名前
デフォルト:なし

(string) (required) The name of the taxonomy
Default: None

戻り値

(boolean)
成功した場合にtrue、失敗した場合にはfalseを返します。

(boolean)
True on success, false on failure.

$taxonomy_exist = taxonomy_exists('category');
//trueを返します。

$taxonomy_exist = taxonomy_exists('post_tag');
//trueを返します。

$taxonomy_exist = taxonomy_exists('link_category');
//trueを返します。

$taxonomy_exist = taxonomy_exists('my_taxonomy');
//グローバル$wp_taxonomies['my_taxonomy']が設定されていない場合、falseを返します。

注意

参照:WordPress_Taxonomy

See Also: WordPress_Taxonomy.

変更ログ

Since: 3.0

ソースファイル

taxonomy_exists()は、wp-includes/taxonomy.php内に位置しています。

taxonomy_exists() is located in wp-includes/taxonomy.php.

関連ファンクションタグ

post_type_exists()

Conditional Tags: comments_open(), is_404(), is_admin(), is_admin_bar_showing(), is_archive(), is_attachment(), is_author(), is_category(), is_comments_popup(), is_date(), is_day(), is_feed(), is_front_page(), is_home(), is_local_attachment(), is_multi_author, is_month(), is_new_day(), is_page(), is_page_template(), is_paged(), is_plugin_active(), is_plugin_active_for_network(), is_plugin_inactive(), is_plugin_page(), is_post_type_archive(), is_preview(), is_search(), is_single(), is_singular(), is_sticky(), is_tag(), is_tax(), is_taxonomy_hierarchical(), is_time(), is_trackback(), is_year(), in_category(), in_the_loop(), is_active_sidebar(), is_active_widget(), is_blog_installed(), is_rtl(), is_dynamic_sidebar(), is_user_logged_in(), has_excerpt(), has_post_thumbnail(), has_tag(), pings_open(), email exists(), post_type_exists(), taxonomy_exists(), term_exists(), username exists(), wp_attachment_is_image(), wp_script_is()

Sponsored Link