Dynamic Home Page based on Log in status

I want to build the home page to show just a login box when logged out and the normal home page when logged in.

Alternatively i can also allow redirection to another page when a logged in user clicks home.

I am using WP membership plugin for membership access.

Thanks

Topic s2member members plugin-members membership Wordpress

Category Web


You can put this on your in your home page template or in your header.php (if you want to use across your entire site).

<?php 
if ( !is_user_logged_in() ) {
    auth_redirect();
}
?>

Details in the Wordpress codex... https://codex.wordpress.org/Function_Reference/auth_redirect

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.