Codex tools: Log in / create account
Contents |
The function register_deactivation_hook (introduced in WordPress 2.0) registers a plugin function to be run when the plugin is deactivated.
<?php register_deactivation_hook($file, $function); ?>
If you have a function called myplugin_deactivate() in the main plugin file at either
use this code:
register_deactivation_hook( __FILE__, 'myplugin_deactivate' );
This will call the myplugin_deactivate() function on deactivation of the plugin.