get_post_types_by_support()
Retrieves a list of post type names that support a specific feature.
No Hooks.
Returns
String[]. A list of post type names.
Usage
get_post_types_by_support( $feature, $operator );
- $feature(array|string) (required)
- Single feature or an array of features the post types should support.
- $operator(string)
- 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'
Notes
- Global. Array.
$_wp_post_type_featuresPost type features
Changelog
| Since 4.5.0 | Introduced. |
get_post_types_by_support() get post types by support code WP 7.0
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 ) );
}