Make WordPress Core

Changeset 56107


Ignore:
Timestamp:
06/29/2023 07:19:04 AM (13 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r56001 r56107  
    10381038    <?php
    10391039    if ( $upgrade_error ) {
    1040         echo '<div class="error"><p>';
    10411040        if ( 'themes' === $upgrade_error ) {
    1042             _e( 'Please select one or more themes to update.' );
     1041            $theme_updates = get_theme_updates();
     1042            if ( ! empty( $theme_updates ) ) {
     1043                echo '<div class="error"><p>';
     1044                _e( 'Please select one or more themes to update.' );
     1045                echo '</p></div>';
     1046            }
    10431047        } else {
    1044             _e( 'Please select one or more plugins to update.' );
    1045         }
    1046         echo '</p></div>';
     1048            $plugin_updates = get_plugin_updates();
     1049            if ( ! empty( $plugin_updates ) ) {
     1050                echo '<div class="error"><p>';
     1051                _e( 'Please select one or more plugins to update.' );
     1052                echo '</p></div>';
     1053            }
     1054        }
    10471055    }
    10481056
Note: See TracChangeset for help on using the changeset viewer.