Registered Users Only Plugin

This plugin disables non-registered access to any content, only registration & login is allowed. The script is very simple:

function registered_users_only() {
    $login_url = "/wp-login.php";
    if ( !is_user_logged_in() && substr( $_SERVER['PHP_SELF'], 0, strlen( $login_url ) ) != $login_url ) {
        auth_redirect();
    }
    
}

add_action('init', 'registered_users_only');

You can download the plugin here: registered-only-plugin.zip

Leave a Reply