This is the basic code: <?php if ( is_user_logged_in() ) { echo 'Welcome, registered user!'; } else { echo 'Welcome, visitor!'; } ?> PHP: But when user is logged in I want the out put like this: Welcome, FIRST NAME OF THE PERSON, if first name field is empty then the USERNAME of the logged in user.