mirror of
https://github.com/WenPai-org/wp-china-yes.git
synced 2025-08-08 06:56:08 +08:00
feat:增加激活插件时配置初始化及禁用插件时配置清空的代码
This commit is contained in:
parent
fbaf4ea4df
commit
36d23f3780
1 changed files with 20 additions and 0 deletions
|
@ -30,6 +30,26 @@ if (is_admin()) {
|
||||||
require __DIR__ . '/setting.php';
|
require __DIR__ . '/setting.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化设置项
|
||||||
|
*/
|
||||||
|
if (empty(get_option('wpapi')) || empty(get_option('super_gravatar')) || empty(get_option('super_googlefonts'))) {
|
||||||
|
update_option("wpapi", '1');
|
||||||
|
update_option("super_gravatar", '1');
|
||||||
|
update_option("super_googlefonts", '2');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用插件时删除配置
|
||||||
|
*/
|
||||||
|
register_deactivation_hook(__FILE__, function () {
|
||||||
|
delete_option("wpapi");
|
||||||
|
delete_option("super_gravatar");
|
||||||
|
delete_option("super_googlefonts");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单注册
|
* 菜单注册
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue