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/tests/phpunit/tests/theme/support.php

    r30148 r37308  
    5151        remove_theme_support( 'post-thumbnails' );
    5252        $this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
     53    }
     54
     55    /**
     56     * @ticket 22080
     57     */
     58    public function test_post_thumbnails_mixed_args() {
     59        add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
     60        add_theme_support( 'post-thumbnails', array( 'page' ) );
     61        $this->assertTrue( current_theme_support( 'post-thumbnails', 'post' ) );
     62        $this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
     63        $this->assertEquals(
     64            array( 0 => array( 'post', 'page' ) ),
     65            get_theme_support( 'post-thumbnails' )
     66        );
     67
     68        add_theme_support( 'post-thumbnails' );
     69        $this->assertTrue( current_theme_supports( 'post-thumbnails', 'book' ) );
    5370    }
    5471
Note: See TracChangeset for help on using the changeset viewer.