admin管理员组文章数量:1384701
I'm using WP to build a help/training portal for a commercial software product (Product X). We'd like to restrict access to this new WP site to only authenticated users of Product X as it contains sensitive information. Integrating with Product X's auth API is not a problem (I've done this before). However, all the docs/examples related to customizing WP auth seem focused on the WP admin portal, not the actual WP site. Is such a thing supported? If so, links to examples/docs would be appreciated.
I'm using WP to build a help/training portal for a commercial software product (Product X). We'd like to restrict access to this new WP site to only authenticated users of Product X as it contains sensitive information. Integrating with Product X's auth API is not a problem (I've done this before). However, all the docs/examples related to customizing WP auth seem focused on the WP admin portal, not the actual WP site. Is such a thing supported? If so, links to examples/docs would be appreciated.
Share Improve this question edited Apr 30, 2020 at 15:59 Mitch A asked Apr 30, 2020 at 15:43 Mitch AMitch A 1011 bronze badge 3- 3 It's possible to redirect all non-logged in users to the login page. Then you restrict who can/can not register for the site, so I assume you'd use Product X's API to authenticate/create accounts. I guess you'd have to build some sort of single sign-on utility, so they'd sign in to Product X's site and then be auto-logged in via WordPress? – Tony Djukic Commented Apr 30, 2020 at 16:11
- This is a basic method: peterstavrou/blog/website/… Also take a look at: codex.wordpress/Function_Reference/auth_redirect See Yahya's answer to this question: wordpress.stackexchange/questions/131879/… – Tony Djukic Commented Apr 30, 2020 at 16:16
- Does this answer your question? How to redirect non-logged in users to a specific page? – cjbj Commented Apr 30, 2020 at 16:43
1 Answer
Reset to default 0Add this to the top of your header.php file, or a file that will be loaded at the top of every page.
<?php
if(!is_user_logged_in()) {
wp_redirect('/wp-login.php');
exit;
}
?>
Someone will probably point out a reason why not to do this, but it's the first thing that came to mind.
本文标签: pluginsprevent anonymous access to Wordpress site (nonadmin site)
版权声明:本文标题:plugins - prevent anonymous access to Wordpress site (non-admin site) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744513477a2610018.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论