WordPress.org

Make WordPress Core

Ticket #34010: 34010.multiple-features.diff

File 34010.multiple-features.diff, 805 bytes (added by barryceelen, 6 years ago)

Allow getting post types by multiple features

  • wp-includes/post.php

    diff --git wp-includes/post.php wp-includes/post.php
    index 59506f8..d75f970 100644
    function post_type_supports( $post_type, $feature ) { 
    15521552}
    15531553
    15541554/**
     1555 * Get a list of post type names that support a specific feature.
     1556 *
     1557 *  @since 4.5.0
     1558 *
     1559 * @param array|string $feature Single feature or an array of features the post types should support.
     1560 * @return array A list of post type names.
     1561 */
     1562function get_post_types_supporting( $args ) {
     1563        global $_wp_post_type_features;
     1564
     1565        $features = array_fill_keys( (array) $args, true );
     1566
     1567        return array_keys( wp_filter_object_list( $_wp_post_type_features, $features ) );
     1568}
     1569
     1570/**
    15551571 * Update the post type for the post ID.
    15561572 *
    15571573 * The page or post cache will be cleaned for the post ID.