【发布时间】:2012-11-06 04:21:36
【问题描述】:
我想通过令牌访问受 WordPress 保护的页面。场景将是:我在 URL 中传递一个令牌,而不是检查请求的页面是否,如果是,则页面是否受保护,如果是,则检查 URL 是否具有令牌,是否检查令牌是否匹配或不是。
更新
我发现并在我的情况下有效的解决方法
function check_token() {
if (post_password_required() && (!empty($_GET['token'])) ){
if($_GET['token'] == 'test'){
global $post;
$post->post_password=null;
}
}
}
add_action('wp_head','check_token');
【问题讨论】: