Skip to content

Instantly share code, notes, and snippets.

@mikeott
Created January 13, 2025 02:22
Show Gist options
  • Save mikeott/6fcfbdba03a3575f738ae32143d370ed to your computer and use it in GitHub Desktop.
Save mikeott/6fcfbdba03a3575f738ae32143d370ed to your computer and use it in GitHub Desktop.
check-for-plugin-update
/* 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