get_post_types_by_support()

最后更新于:2021-11-26 22:48:12

get_post_types_by_support( array|string$feature, string$operator=’and’)

Retrieves a list of post type names that support a specific feature.

参数

$feature

(array|string) (Required) Single feature or an array of features the post types should support.

$operator

(string) (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 value: ‘and’

响应

(string[]) A list of post type names.

源文件

文件: gc-includes/post.php

function get_post_types_by_support( $feature, $operator = 'and' ) {
	global $_gc_post_type_features;

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

	return array_keys( gc_filter_object_list( $_gc_post_type_features, $features, $operator ) );
}