From 4101f1f7eb9106f1506008ba6bb65f658899a862 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 24 Jan 2022 10:39:50 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@52628 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 33b1d9ecfc..5b6881dec2 100644 --- a/src/wp-includes/functions.php +++ b/src/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, '>=' ); } /**