register_uninstall_hook


register_uninstall_hook ( $file, $callback )

Parameters:
  • (string) file Plugin file.
  • (callable) callback The callback to run when the hook is called. Must be a static method or function.
Defined at:

Description

Sets the uninstallation hook for a plugin.Registers the uninstall hook that will be called when the user clicks on the uninstall link that calls for the plugin to uninstall itself. The link won't be active unless the plugin hooks into the action. The plugin should not run arbitrary code outside of functions, when registering the uninstall hook. In order to run using the hook, the plugin will have to be included, which means that any code laying outside of a function will be run during the uninstallation process. The plugin should not hinder the uninstallation process. If the plugin can not be written without running code within the plugin, then the plugin should create a file named 'uninstall.php' in the base plugin folder. This file will be called, if it exists, during the uninstallation process bypassing the uninstall hook. The plugin, when using the 'uninstall.php' should always check for the 'WP_UNINSTALL_PLUGIN' constant, before executing.

Related Functions

register_taxonomy, register_activation_hook, register_initial_settings, register_rest_route, unregister_meta_key

Top Google Results

User discussions

wpseek mobile