guet_post_types_by_support( array|string   $feature , string   $operator = 'and' ): string[]

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

Parameters

$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 elemens must match; 'not' means no elemens may match. Default 'and' .

Default: 'and'

Return

string[] A list of post type names.

Source

function guet_post_types_by_support( $feature, $operator = 'and' ) {
	global $_wp_post_type_features;

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

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

Changuelog

Versionen Description
4.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.