WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As many of you know WPEngine don't support PHP SESSIONS unless the user is logged in. In that case WPEngine start taking consideration of PHP SESSIONS and the software based on hybridauth like Wordpress Social Login or Wordpress Social Invitations will work ok.

So my question is : There is a way to fake a Wordpress login?

share|improve this question
up vote 2 down vote accepted

You could create a dummy user (with no rights) and log in every visitor using this dummy user. This could be done pretty easily:

wp_set_auth_cookie($uid, true);

But in my opinion that's a rather flawy workaround.

Your main problem is that all pages for not-logged-in users come from the page-cache. That also means that all users get the same html output as long as there is page-caching active. So there can't be any difference to your pages based on the visitor. All visitors get the same output.

A better way would be to create a ticket at WPEngine and ask them to disable page-caching for your site. That's actually also the way they suggest on the page you linked to.

share|improve this answer
I don't have am account on WPengine, just my plugin users got. The idea of this is that the user should appear not logged to Wordpress, but logged to WPengine :D – chifliiiii Jul 13 '13 at 20:15
Ah I see. Seems like WPengine is using the wordpress login cookie to determine if one is logged in or not: WordPress sets cookies related to that login, and our system is set up to recognize those WordPress login cookies. You may have a chance in creating a fake cookie with an invalid session. If WPEngine is only looking for the existence of the login cookie. But this seems like a really dirty hack, that could break other tings. Maybe you should just tell your users to contact WPEngine and let them disable caching (place it in your FAQ or something). – s1lv3r Jul 15 '13 at 8:57
Exactly, im looking for a dirty hack :) – chifliiiii Jul 15 '13 at 14:11
:-P Then you may try to create a cookie named wordpress_logged_in_{random_md5_1} and value user|{current_timestamp}|{another_random_md5_2} and an cookie wordpress_{random_md5_1} and value user|{current_timestamp}|{another_random_md5_3}. You won't be really logged in as you don't have a real session, but if WPEngine only looks for the existence of a session cookie as stated in their docs, there's a good chance that they'll eat it. – s1lv3r Jul 15 '13 at 14:21
Derivation of ideas discussed in this thread, which for now is working for our needs on WPEngine: gist.github.com/wkw/6fc5aeb598ec0c1aa151 I took the idea of a fake user-session cookie and am using it to selectively enable/disable caching for dynamic content. – wkw Oct 6 '15 at 2:23

A quick and hacky solution is to put this in your header include file:

  // Re-enable sessions for WPEngine
  setcookie('wordpress_logged_in_' . md5("test"), md5("random"), time()+3600);

It's wrong, but it works.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.