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. Built from https://develop.svn.wordpress.org/trunk@37308 git-svn-id: http://core.svn.wordpress.org/trunk@37274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f3b7842281
commit
af5c5a9a25
|
@ -1535,6 +1535,24 @@ function add_theme_support( $feature ) {
|
||||||
$args = array_slice( func_get_args(), 1 );
|
$args = array_slice( func_get_args(), 1 );
|
||||||
|
|
||||||
switch ( $feature ) {
|
switch ( $feature ) {
|
||||||
|
case 'post-thumbnails':
|
||||||
|
// All post types are already supported.
|
||||||
|
if ( true === get_theme_support( 'post-thumbnails' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Merge post types with any that already declared their support
|
||||||
|
* for post thumbnails.
|
||||||
|
*/
|
||||||
|
if ( is_array( $args[0] ) && is_array( $_wp_theme_features['post-thumbnails'][0] ) ) {
|
||||||
|
$post_types = array_unique( array_merge( $args[0], $_wp_theme_features['post-thumbnails'][0] ) );
|
||||||
|
|
||||||
|
$args = array( $post_types );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'post-formats' :
|
case 'post-formats' :
|
||||||
if ( is_array( $args[0] ) ) {
|
if ( is_array( $args[0] ) ) {
|
||||||
$post_formats = get_post_format_slugs();
|
$post_formats = get_post_format_slugs();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-alpha-37307';
|
$wp_version = '4.6-alpha-37308';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue