Created
January 2, 2024 18:33
-
-
Save jeremysimmons/9c8ad29618da87d8153a23f39857df34 to your computer and use it in GitHub Desktop.
wordpress upgrader_process_complete example
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
function my_plugins_update_completed( $upgrader_object, $options ) { | |
// If an update has taken place and the updated type is plugins and the plugins element exists | |
if ( $options['action'] == 'update' && $options['type'] == 'plugin' && isset( $options['plugins'] ) ) { | |
foreach( $options['plugins'] as $plugin ) { | |
// Check to ensure it's my plugin | |
if( $plugin == plugin_basename( __FILE__ ) ) { | |
// do stuff here | |
} | |
} | |
} | |
} | |
add_action( 'upgrader_process_complete', 'my_plugins_update_completed', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment