wp_get_current_user()

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();
		} 

Leave a Reply

Your email address will not be published. Required fields are marked *