get_post_types_by_support

The timeline below displays how wordpress function get_post_types_by_support has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.4

/**
 * Retrieves a list of post type names that support a specific feature.
 *
 * @since 4.5.0
 *
 * @global array $_wp_post_type_features Post type features
 *
 * @param array|string $feature  Single feature or an array of features the post types should support.
 * @param 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'.
 * @return string[] A list of post type names.
 */
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));
}

WordPress Version: 4.5

/**
 * Retrieves a list of post type names that support a specific feature.
 *
 * @since 4.5.0
 *
 * @global array $_wp_post_type_features Post type features
 *
 * @param array|string $feature  Single feature or an array of features the post types should support.
 * @param 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'.
 * @return array A list of post type names.
 */
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));
}