0

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.

3

1 Answer 1

0

Add 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.