register_deactivation_hook()

register_deactivation_hook( string $file, callable $function )

设置插件的停用挂钩。
Set the deactivation hook for a plugin.
目录锚点:#说明#参数#返回#源码#笔记

说明(Description)

当插件被停用时,将调用“deactivate_PLUGINNAME”操作挂钩。在这个钩子的名称中,plugin name被替换为插件的名称,包括可选的子目录。例如,当插件位于wp content/plugins/sampleplugin中时/示例.php,则此钩子的名称将变为“deactivateu sampleplugin”/示例.php’.

当插件只包含一个文件并且(默认情况下)位于wp content/plugins时/示例.php此挂钩的名称将为“deactivate”_示例.php’.


参数(Parameters)

参数类型必填说明
$file (string) 必需 插件的文件名,包括路径。
$function (callable) 必需 函数挂接到“deactivate_PLUGIN”操作。

返回(Return)

无返回值

源码(Source)

更新版本 源码位置 使用 被使用
2.0.0 wp-includes/plugin.php:807 0 2

笔记(Notes)

实例