我使用shiba-example-plugin
作为我的WordPress插件的起点,我在登录后添加了一个过滤器来重定向,所以我可以在让用户访问网站之前再做一次检查。
所以我用:
重定向plugins_url() . '/shiba-example-plugin/check.php?id=' . $user_ID;
我如何构建'check.php'文件,使其能够访问WordPress变量,并在其上显示顶部管理栏?
现在只考虑一个普通的php文件
为了使用WordPress全局变量,你需要包含wp-blog header
。
require($_SERVER['DOCUMENT_ROOT'] . '/wp-blog-header.php');