feat:增加激活插件时配置初始化及禁用插件时配置清空的代码

This commit is contained in:
sunxiyuan 2020-07-19 16:07:52 +08:00
parent fbaf4ea4df
commit 36d23f3780

View file

@ -30,6 +30,26 @@ if (is_admin()) {
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");
});
/**
* 菜单注册
*/