WordPress.org

Make WordPress Core

Ticket #34010: 34010.diff

File 34010.diff, 868 bytes (added by swissspidy, 6 years ago)
  • src/wp-includes/post-functions.php

    diff --git src/wp-includes/post-functions.php src/wp-includes/post-functions.php
    index 58961fe..cfda3fe 100644
    function post_type_supports( $post_type, $feature ) { 
    15441544        return ( isset( $_wp_post_type_features[$post_type][$feature] ) );
    15451545}
    15461546
     1547
     1548/**
     1549 * Get a list of post type names that support a specific feature.
     1550 *
     1551 * @since 4.5.0
     1552 *
     1553 * @param string $feature Feature the post types should support.
     1554 * @return array Names of post types that support the given feature.
     1555 */
     1556function get_post_types_by_support( $feature ) {
     1557        $post_types = array();
     1558
     1559        foreach ( get_post_types() as $post_type ) {
     1560                if ( post_type_supports( $feature ) ) {
     1561                        $post_types[] = $post_type;
     1562                }
     1563        }
     1564
     1565        return $post_types;
     1566}
     1567
    15471568/**
    15481569 * Update the post type for the post ID.
    15491570 *