您可以使用以下操作将所有流量重定向到该登录页面。您需要指定页面名称和页面slug。
add_action(\'wp\', \'wpse_41699_wp\', 0);
function wpse_41699_wp(){
if(is_page(\'Login\'))
return;
if(!is_user_logged_in()){
$url = get_bloginfo(\'home\').\'/login\';
header(\'HTTP/1.1 403 Forbidden\');
header("Location: $url");
exit;
}
}
此外,您还可以下载此答案的插件版本
here.