wordpress check user is logged in 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: Check if user logged in Wordpress through JS
document.body.classList.contains( 'logged-in' );