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: 這個函式檢索已註冊的分類學物件的陣列。它不接受任何引數,並返回一個分類學物件的陣列。

檢索已註冊的分類學名稱或物件的列表。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 );
}
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 ); }
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
檢視更多 >