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.
Example:
Site URL: http://www.this-is-an-example.com
WP URL: http://this-is-an-example.com (missing the “www.”)
Solution:
By adding the “www.” to the WordPress domain name the problem was solved:
- Login to WordPress Admin area
- Go to Settings – General
- Add “www.” to the WordPress address (URL) and Blog address (URL).
#1 by KonstantinMiller on July 7th, 2009
Hi! I like your srticle and I would like very much to read some more information on this issue. Will you post some more?
#2 by Rui Miguel Feio on July 8th, 2009
Hi!
I’m glad you like it!
Yes, I plan to write more about this subject soon.
Cheers!
#3 by Rich on October 12th, 2009
Thank you for this. I’ve been trying to solve this problem for hours.
#4 by Shaven Teenys on November 22nd, 2009
yo.. interesting
)
#5 by DiceSteence on February 15th, 2010
Stunning, I did not heard about this topic up to the present. Thanks!!
#6 by Berry on February 20th, 2010
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
Berry
#7 by ZAREMA on March 19th, 2010
Thanks the author for article. The main thing do not forget about users, and continue in the same spirit.
#8 by Mutu on April 23rd, 2010
Hello
thanks for this tips
#9 by Zen on June 11th, 2010
Hey, nice site you have here! Keep up the good job!
#10 by Cype on July 29th, 2010
Hi im new to this. I came upon this website I have found It absolutely accessible & it’s helped me out so much. I should be able to give something back and guide other users like it has helped me.
Cheers, See You Around
#11 by antaddyfuesty on July 30th, 2010
Howdy every one, superb board I have found It very helpful and its helped me out a lot
I hope to give something back and support other users like this site has helped me