WordPress.org

Make WordPress Core

Changeset 37313


Ignore:
Timestamp:
04/26/2016 08:28:46 PM (4 years ago)
Author:
rachelbaker
Message:

Post Thumbnails: Fix logic bug and tests from [37308] where post-thumbnails support wasn’t added if there were no previous post_types with support already.

See #22080

Location:
trunk
Files:
2 edited

Legend:

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

    r37308 r37313  
    15461546             * for post thumbnails.
    15471547             */
    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 );
     1548            if ( is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) {
     1549                $args[0] = array_unique( array_merge( $_wp_theme_features['post-thumbnails'][0], $args[0] ) );
    15521550            }
    15531551
  • trunk/tests/phpunit/tests/theme/support.php

    r37309 r37313  
    4545
    4646    public function test_post_thumbnails_flat_array_of_post_types() {
     47        remove_theme_support( 'post-thumbnails' );
     48
    4749        add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
    48         $this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
    4950        $this->assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
    5051        $this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
     
    6869        add_theme_support( 'post-thumbnails' );
    6970        $this->assertTrue( current_theme_supports( 'post-thumbnails', 'book' ) );
     71
     72        // Reset post-thumbnails theme support.
     73        remove_theme_support( 'post-thumbnails' );
     74        $this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
    7075    }
    7176
Note: See TracChangeset for help on using the changeset viewer.