wordpress javascript works when logged in but not logged out code example Example: detect logged user wordpress javascript document.body.classList.contains( 'logged-in' );