This technique was used to control WPEngine's caching by making WPE think there was a WordPress CMS user logged in by setting a fake cookie.
This code was developed to display site-wide dynamic content when a user authenticated against an external (non-WordPress) service.
N.B.: this worked as of 10/2015, but WPE may make infratructure changes which break the technique.
When you need to disable caching, call maybe_set_user_cookie()
. This function must be called on every page load until you no longer need to disable caching. To stop the caching and remove the fake cookie, call remove_user_cookie()
.
Typical usage would be to set the cookie just before you need it and continue to set it until caching can be enabled again for the current user.
Still working as of today.