From b58eebb2a520493cd357affb00539e0b540170c4 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 29 Jun 2023 07:19:04 +0000 Subject: [PATCH] Upgrade/Install: Only show errors if there is nothing to update. Previously, when the `do-plugin-upgrade` or `do-theme-upgrade` actions were accessed directly on `update-core.php`, an error message stating "Select one or more (plugins|themes) to update" would be shown even if there was nothing to update. This ensures that the error message only appears when there is something to update. Props Presskopp, sabernhardt, pbiron, afragen, zunaid321, shuvoaftab, ugyensupport, costdev. Fixes #57999. git-svn-id: https://develop.svn.wordpress.org/trunk@56107 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/update-core.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php index 7caa1063c1..3aefbb89ba 100644 --- a/src/wp-admin/update-core.php +++ b/src/wp-admin/update-core.php @@ -1037,13 +1037,21 @@ if ( 'upgrade-core' === $action ) {

'; if ( 'themes' === $upgrade_error ) { - _e( 'Please select one or more themes to update.' ); + $theme_updates = get_theme_updates(); + if ( ! empty( $theme_updates ) ) { + echo '

'; + _e( 'Please select one or more themes to update.' ); + echo '

'; + } } else { - _e( 'Please select one or more plugins to update.' ); + $plugin_updates = get_plugin_updates(); + if ( ! empty( $plugin_updates ) ) { + echo '

'; + _e( 'Please select one or more plugins to update.' ); + echo '

'; + } } - echo '

'; } $last_update_check = false;