From af5c5a9a25ea06f36a846101740f18ac560ef044 Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Tue, 26 Apr 2016 17:05:31 +0000 Subject: [PATCH] =?UTF-8?q?Post=20Thumbnails:=20When=20using=20`add=5Fthem?= =?UTF-8?q?e=5Fsupport(=20=E2=80=98post-thumbnails=E2=80=99,=20array(=20$p?= =?UTF-8?q?ost=5Ftypes)=20)`=20merge=20the=20supported=20post=5Ftypes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- wp-includes/theme.php | 18 ++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index f4dfaeedc2..2f7dc1fca7 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1535,6 +1535,24 @@ function add_theme_support( $feature ) { $args = array_slice( func_get_args(), 1 ); 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' : if ( is_array( $args[0] ) ) { $post_formats = get_post_format_slugs(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 721cf0c90b..e52c4bf0c6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.