get if user is already logged in php wordpress code example
Example 1: if user logged in wordpress
if ( is_user_logged_in() ) {
// your code for logged in user
} else {
// your code for logged out user
}
Example 2: php redirect if not logged in
if(!isset($_SESSION['login'])){ //if login in session is not set
header("Location: http://www.example.com/login.php");
}