get_post_types_by_support

函式
get_post_types_by_support ( $feature, $operator = 'and' )
引數
  • (array|string) $feature Single feature or an array of features the post types should support.
    Required:
  • (string) $operator Optional. The logical operation to perform. 'or' means only one element from the array needs to match; 'and' means all elements must match; 'not' means no elements may match. Default 'and'.
    Required:
    Default: 'and'
返回值
  • (string[]) A list of post type names.
定義位置
相關方法
get_all_post_type_supportspost_type_supportsremove_post_type_supportadd_post_type_supportget_post_types
引入
4.5.0
棄用
-

get_post_types_by_support函式是一個WordPress函式,它檢索一個支援指定功能的文章型別名稱陣列: 這個函式將特徵名稱作為引數,並返回一個文章型別名稱的陣列。

檢索一個支援特定功能的文章型別名稱列表。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_post_types_by_support( $feature, $operator = 'and' ) {
global $_wp_post_type_features;
$features = array_fill_keys( (array) $feature, true );
return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) );
}
function get_post_types_by_support( $feature, $operator = 'and' ) { global $_wp_post_type_features; $features = array_fill_keys( (array) $feature, true ); return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) ); }
function get_post_types_by_support( $feature, $operator = 'and' ) {
	global $_wp_post_type_features;

	$features = array_fill_keys( (array) $feature, true );

	return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) );
}

常見問題

FAQs
檢視更多 >