简体   繁体   English

如何只允许注册用户访问我的WordPress网站

[英]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.

相关问题 如何只允许注册用户访问他们在mysql数据库中的信息? - How to allow only registered users to have access to their information in mysql database? 允许我的ASP.Net MVC网站中的用户访问我的私人WordPress网站 - Allow users from my ASP.Net MVC site to access my private WordPress site PHP:如何只允许注册用户转到另一个页面 - PHP : how to allow only registered users to go to another page 如何将openid用于仅允许授权用户访问网站的网站登录系统 - how to use openid for login system in website that allow only authorized users to access site 如何允许用户从WordPress网站下载内容 - How to allow users to download content from WordPress site 如何仅通过Wordpress中的表单允许页面访问 - How to allow page access ONLY by form in Wordpress 如何只允许某些选定的用户从站点下载数据 - how to allow only certain selected users to download data from site 如何将用户重定向到另一个站点并仅允许漫游器索引? - How to redirect users to another site and allow only bots to index? 只允许某些 ip 访问我的“家庭网站”? - only allow certain ips to access my “family site”? 如果用户登录到Wordpress站点,如何允许URL重定向? - How to allow url redirection only if user logged in to Wordpress site?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM