I have never had the need to use this function, but am building a new site that will rely on it heavily. I have tried adding the following code to the header:
<?php
if ( is_user_logged_in() ) {
echo 'Welcome, registered user!';
} else {
echo 'Welcome, visitor!';
}
?>
This always returns "Welcome, visitor!" even if I am logged in in the same browser and same session. I have tried every browser I have, with no success.
I tested this on some of my existing wordpress sites, and it works fine.
The new site I am making is on a different server. The other things that are different are I have search engines blocked, and rather that have wordpress in the root folder, it is in a subfolder called "cms" but these do not seem to be causing any other problems.
Any ideas or suggestions would be appreciated!