Dodaj poniższy kod do pliku functions.php
/**
* Redirect users who aren't logged in...
*/
function wpnet_members_only() {
global $pagenow;
// Check to see if user in not logged in and not on the login page.
if ( ! is_user_logged_in() && 'wp-login.php' !== $pagenow ) {
auth_redirect();
}
}
add_action( 'wp', 'wpnet_members_only' );