When checking if the update notice should be shown, compare minor version, not the patch version

Fixes #14333
This commit is contained in:
Mike Jolley 2017-04-13 13:15:49 +01:00
parent 712e84251d
commit 412ddeacda
1 changed files with 12 additions and 2 deletions

View File

@ -855,11 +855,21 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
$upgrade_notice = '';
if ( preg_match( $regexp, $content, $matches ) ) {
$version = trim( $matches[1] );
$notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) );
// Convert the full version strings to minor versions.
$notice_version_parts = explode( '.', trim( $matches[1] ) );
$current_version_parts = explode( '.', WC_VERSION );
if ( 3 !== sizeof( $notice_version_parts ) ) {
return;
}
$notice_version = $notice_version_parts[0] . '.' . $notice_version_parts[1];
$current_version = $current_version_parts[0] . '.' . $current_version_parts[1];
// Check the latest stable version and ignore trunk.
if ( $version === $new_version && version_compare( WC_VERSION, $version, '<' ) ) {
if ( version_compare( $current_version, $notice_version, '<' ) ) {
$upgrade_notice .= '</p><p class="wc_plugin_upgrade_notice">';