Quick code that checks to see if current user is logged in. Anything other than “0” is logged in.
//Grab the current user details from WordPress $current_user = wp_get_current_user(); if ( 0 == $current_user->ID ) { echo 'Sorry. You need to be logged in to see this information....'; die(); }