Wordpress: PHP is user logged in > is_user_logged_in()

March 21st, 2009 by jeremychone

<?php
if ( is_user_logged_in() ) {echo ‘WordPress says you\’re logged in!’;}
else if ( !is_user_logged_in() ) {echo ‘WordPress says you\’re not logged in!’;}
?>

Particularly useful to avoid adding Google Analytic code when the user is logged-in. For example, if you are editing you blog from different access point, the Google Analytic filters can become cumbersome to manage.

Leave a Reply