[英]How to only allow registered users to access my WordPress site
I have used the password protect but its no good, I want the users in my users table to only access my wordpress site. 我使用了密码保护,但是效果不好,我希望用户表中的用户只能访问我的wordpress网站。 Is there a plugin I can use or a go around to this.If anyone visits the site they are forced to login or taken to the wp-login which when successful will take the user to the website.
有没有我可以使用的插件或可以解决这个问题。如果有人访问该网站,他们将被迫登录或进入wp-login,一旦成功登录,该用户将被带到该网站。 Is there a way.
有没有办法。
Of course there is a way. 当然有办法。
<?php if(!is_user_logged_in()){wp_redirect( 'http://www.your-blog.com/wp-login' ); exit;}?>
Put the above code on top of everything in your theme's header.php 将上面的代码放在主题的header.php中的所有内容之上
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.