WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/26/2016 05:04:25 PM (4 years ago)
Author:
rachelbaker
Message:

Post Thumbnails: When using add_theme_support( ‘post-thumbnails’, array( $post_types) ) merge the supported post_types.

Allow the adding of post-thumbnail support for one or more post_types without unsetting any previously added post_types. This matches the behavior of other uses of add_theme_support() and the expectations of a function with a prefix of “add”.
To unset post-thumbnail support use remove_theme_support() instead.

Fixes #22080

Props alexkingorg, jmichaelward, and flixos90.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r37092 r37308  
    15361536
    15371537    switch ( $feature ) {
     1538        case 'post-thumbnails':
     1539            // All post types are already supported.
     1540            if ( true === get_theme_support( 'post-thumbnails' ) ) {
     1541                return;
     1542            }
     1543
     1544            /*
     1545             * Merge post types with any that already declared their support
     1546             * for post thumbnails.
     1547             */
     1548            if ( is_array( $args[0] ) && is_array( $_wp_theme_features['post-thumbnails'][0] ) ) {
     1549                $post_types = array_unique( array_merge( $args[0], $_wp_theme_features['post-thumbnails'][0] ) );
     1550
     1551                $args = array( $post_types );
     1552            }
     1553
     1554            break;
     1555
    15381556        case 'post-formats' :
    15391557            if ( is_array( $args[0] ) ) {
Note: See TracChangeset for help on using the changeset viewer.