Created
January 13, 2025 02:22
-
-
Save mikeott/6fcfbdba03a3575f738ae32143d370ed to your computer and use it in GitHub Desktop.
check-for-plugin-update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Check for updates */ | |
function my_custom_update_checker() { | |
$allowed_pages = array( | |
'update-core', | |
'plugins', | |
'plugin-install', | |
'network/update-core', | |
'network/plugins', | |
'network/plugin-install', | |
'update' | |
); | |
add_action('current_screen', function($screen) use ($allowed_pages) { | |
if (in_array($screen->id, $allowed_pages)) { | |
my_update_checker(); /* The actual update function */ | |
} | |
}); | |
} | |
add_action('admin_init', 'my_custom_update_checker'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment