Skip to content

Commit

Permalink
need to find and set current page when running in mu-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
afragen committed Feb 24, 2025
1 parent 79e707e commit a92db55
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lite.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ private function check_update_uri( $updateUri ) {
public function run() {
global $pagenow;

// Needed for mu-plugin.
if ( ! isset( $pagenow ) ) {
$php_self = isset( $_SERVER['PHP_SELF'] ) ? sanitize_url( wp_unslash( $_SERVER['PHP_SELF'] ) ) : null;
if ( null !== $php_self ) {
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$pagenow = basename( $php_self );
}
}

// Only run on the following pages.
$pages = array( 'update-core.php', 'update.php', 'plugins.php', 'themes.php' );
$view_details = array( 'plugin-install.php', 'theme-install.php' );
Expand Down

0 comments on commit a92db55

Please sign in to comment.