register_deactivation_hook()

最后更新于:2021-11-27 21:32:52

register_deactivation_hook( string$file, callable$callback)

Sets the deactivation hook for a plugin.

参数

$file

(string) (Required) The filename of the plugin including the path.

$callback

(callable) (Required) The function hooked to the ‘deactivate_PLUGIN’ action.

源文件

文件: gc-includes/plugin.php

function register_deactivation_hook( $file, $callback ) {
	$file = plugin_basename( $file );
	add_action( 'deactivate_' . $file, $callback );
}