mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 23:00:21 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@37308 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -52,6 +52,23 @@ class Tests_Theme_Support extends WP_UnitTestCase {
|
||||
$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 22080
|
||||
*/
|
||||
public function test_post_thumbnails_mixed_args() {
|
||||
add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
|
||||
add_theme_support( 'post-thumbnails', array( 'page' ) );
|
||||
$this->assertTrue( current_theme_support( 'post-thumbnails', 'post' ) );
|
||||
$this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
|
||||
$this->assertEquals(
|
||||
array( 0 => array( 'post', 'page' ) ),
|
||||
get_theme_support( 'post-thumbnails' )
|
||||
);
|
||||
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
$this->assertTrue( current_theme_supports( 'post-thumbnails', 'book' ) );
|
||||
}
|
||||
|
||||
public function test_post_thumbnails_types_true() {
|
||||
// array of arguments, with the key of 'types' holding the post types.
|
||||
add_theme_support( 'post-thumbnails', array( 'types' => true ) );
|
||||
|
||||
Reference in New Issue
Block a user