get_taxonomies

函数
get_taxonomies ( $args = array(), $output = 'names', $operator = 'and' )
参数
  • (array) $args Optional. An array of `key => value` arguments to match against the taxonomy objects. Default empty array.
    Required:
    Default: array()
  • (string) $output Optional. The type of output to return in the array. Accepts either taxonomy 'names' or 'objects'. Default 'names'.
    Required:
    Default: 'names'
  • (string) $operator Optional. The logical operation to perform. Accepts 'and' or 'or'. 'or' means only one element from the array needs to match; 'and' means all elements must match. Default 'and'.
    Required:
    Default: 'and'
返回值
  • (string[]|WP_Taxonomy[]) An array of taxonomy names or objects.
定义位置
相关方法
get_the_taxonomiesthe_taxonomiesget_post_taxonomiesget_taxonomyget_object_taxonomies
引入
3.0.0
弃用
-

get_taxonomies: 这个函数检索已注册的分类学对象的数组。它不接受任何参数,并返回一个分类学对象的数组。

检索已注册的分类学名称或对象的列表。

function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
	global $wp_taxonomies;

	$field = ( 'names' === $output ) ? 'name' : false;

	return wp_filter_object_list( $wp_taxonomies, $args, $operator, $field );
}

常见问题

FAQs
查看更多 >