Use the following code to check if the user is logged into wordpress

if(is_user_logged_in()) {
 // User is logged in
}else{
 // User is not logged in
}