From 3fc623c202a563b55676455733af9a6232443081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helen=20Hou-Sand=C3=AD?= Date: Tue, 27 Oct 2020 20:00:06 +0000 Subject: [PATCH] Post Formats: You have to pass an array of supported post formats. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This shows a `_doing_it_wrong()` message and also returns false instead of true if no array of formats is passed in `add_theme_support()`, avoiding a PHP error. Post formats maintainership comes full circle. 🙃 Props Mista-Flo, sproutchris, garrett-eclipse. Fixes #51390. Built from https://develop.svn.wordpress.org/trunk@49344 git-svn-id: http://core.svn.wordpress.org/trunk@49104 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/theme.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 8e8a5779d4..237a4d3e14 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -2481,6 +2481,7 @@ function get_theme_starter_content() { * by adding it to the function signature. * @since 5.5.0 The `core-block-patterns` feature was added and is enabled by default. * @since 5.5.0 The `custom-logo` feature now also accepts 'unlink-homepage-logo'. + * @since 5.6.0 The `post-formats` feature now returns doing it wrong if no array is passed * * @global array $_wp_theme_features * @@ -2523,6 +2524,9 @@ function add_theme_support( $feature, ...$args ) { unset( $post_formats['standard'] ); $args[0] = array_intersect( $args[0], array_keys( $post_formats ) ); + } else { + _doing_it_wrong( "add_theme_support( 'post-formats' )", __( 'You need to pass an array of types.' ), '5.6.0' ); + return false; } break; diff --git a/wp-includes/version.php b/wp-includes/version.php index b491a8d376..f87cbcd524 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-beta1-49343'; +$wp_version = '5.6-beta1-49344'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.