Title: Cache stopping set cookie
Last modified: July 5, 2023

---

# Cache stopping set cookie

 *  Resolved [lozguiel](https://wordpress.org/support/users/lozguiel/)
 * (@lozguiel)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cache-stopping-set-cookie/)
 * Hi. I’m trying to set some cookies and everything works fine when the ?swcfpc
   =1 parameter is added. As soon as I’m not logged in, the cookie won’t set. How
   can I get around this? Am I being real stupid and missing something obvious (
   sorry, it’s been a very long week).
 * Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cache-stopping-set-cookie/#post-16874236)
 * Hi [@lozguiel](https://wordpress.org/support/users/lozguiel/),
   When you are using
   the `?swcfpc=1` cache buster query param, your pages are always bypassed from
   Cache. Now if you are setting cookies at the PHP level then I will highly recommend
   you not to do it. Cause as soon as you set cookies and there is a `set-cookie`
   header in the page response, Cloudflare will not cache that page as it will think
   that the cookie value might be used inside the webpage to show content dynamically.
 * Instead, you should use JavaScript. In JS you can either take advantage of LocalStorage
   API to store things or you can set cookies using JS in both of these cases cache
   behaviour will not be hampered.
 * In your current case, if you purge the cache of your entire website and I’m sure
   you will start seeing the cookie you have added at the PHP level.
 *  Thread Starter [lozguiel](https://wordpress.org/support/users/lozguiel/)
 * (@lozguiel)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cache-stopping-set-cookie/#post-16874433)
 * That’s brilliant! Thanks very much for your help. I think the JS solution will
   be perfect 🙂
 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cache-stopping-set-cookie/#post-16874545)
 * Hi [@lozguiel](https://wordpress.org/support/users/lozguiel/),
   Happy to help.
   🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Cache stopping set cookie’ is closed to new replies.

 * ![](https://ps.w.org/wp-cloudflare-page-cache/assets/icon-256x256.gif?rev=3234997)
 * [Super Page Cache](https://wordpress.org/plugins/wp-cloudflare-page-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cloudflare-page-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [iSaumya](https://wordpress.org/support/users/isaumya/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/cache-stopping-set-cookie/#post-16874545)
 * Status: resolved