PHP Session not being passed from a web site to WordPress

Recently I had this case where a PHP session ($_SESSION) was not being passed from a web site to WordPress.

Basically, WordPress was installed and configured to be part of a web site and there was the need to use Sessions to control the login/logout process of the site.

Although the session_start() had been defined to WordPress, the latter did not recognize the session values and therefore simply ignored if a user was logged on.

After some research and some brainstorming with some great experts on the field, I realized that the problem was in the WordPress URL itself.

The problem was that although the domain was the same, WordPress was suppressing the “www” from the URL which caused the $_SESSION values not to be recognized.


Site URL:

WP URL:  (missing the “www.”)


By adding the “www.” to the WordPress domain name the problem was solved:

  1. Login to WordPress Admin area
  2. Go to SettingsGeneral
  3. Add “www.” to the WordPress address (URL) and Blog address (URL).


  1. You made some good points there. I did a search on the topic and found most people will agree with
    your blog.

  2. Thanks the author for article. The main thing do not forget about users, and continue in the same spirit.

  3. I’m new around here, seems like a cool place though. I’ll be around a bit, more of a lurker than a poster though 🙂


Leave a Reply

Your email address will not be published.


This site uses Akismet to reduce spam. Learn how your comment data is processed.