From 70a7faa9dc2bdd6de1b9d4f94731dd0d0a65f626 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 24 Jan 2022 10:41:01 +0000 Subject: [PATCH] Plugins/Themes: Allow to install/activate plugins/themes which require the WordPress version currently in development. Twenty Twenty-Two requires WordPress 5.9 but currently can't be (re)activated in the 5.9 branch because `version_compare( '5.9-RC3-52627', '5.9', '>=' )` as used by `is_wp_version_compatible()` returns `false`. To appreciate the testing of upcoming versions any `-alpha`, `-RC`, `-beta` suffixes are now stripped off from the WordPress version before checking for compatibility. Fixes #54882. Built from https://develop.svn.wordpress.org/trunk@52628 git-svn-id: http://core.svn.wordpress.org/trunk@52216 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 9 ++++++++- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 33b1d9ecfc..5b6881dec2 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -8342,11 +8342,18 @@ function clean_dirsize_cache( $path ) { * * @since 5.2.0 * + * @global string $wp_version WordPress version. + * * @param string $required Minimum required WordPress version. * @return bool True if required version is compatible or empty, false if not. */ function is_wp_version_compatible( $required ) { - return empty( $required ) || version_compare( get_bloginfo( 'version' ), $required, '>=' ); + global $wp_version; + + // Strip off any -alpha, -RC, -beta, -src suffixes. + list( $version ) = explode( '-', $wp_version ); + + return empty( $required ) || version_compare( $version, $required, '>=' ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 8316a413c9..fa008333f0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52626'; +$wp_version = '6.0-alpha-52628'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.