I ran a GTmetrix test on my site (example.com) and got a very low score (50) for "coockie free domains". I gather from this error that the webpage of each URL of my domain is served with cookie recording.

But, I don't want to record cookies for any of my users. I have no usage in these cookies and shouldn't have one in the horizon.

I read that a CDN can do it for me and prevent me of getting the error due to slow self-serving of webpages with cookie-recording, but I also don't desire to use a CDN to serve cookie free URLs for my domain.

Thus, I pasted this in the very end of wp-config.php of my site, and saved:

define("WP_CONTENT_URL", "http://static.example.com"); 
define("COOKIE_DOMAIN", "example.com");

After pasting this, I've noticed it requires a subdomain from which to record cookies, but I don't want to use a subdomain at all.

How could I serve webpages without gathering any cookies, in my WordPress website, without using either a CDN or a subdomain. I just don't want to gather any cookies in that time.

  • WordPress doesn’t set cookies for site visitors. It sets cookies for admin user logins and for people commenting on posts. You may have a plugin or theme that sets cookies. GTMetrix may also just be testing whether your domain can set cookies rather than whether it does and you should analyse your site server headers to be sure. – Andy Macaulay-Brook Apr 7 '18 at 9:09
  • Is there a way to totally disable all cookies whatsoever? – Ben Apr 7 '18 at 9:15
  • Turn off all commenting. I don’t believe that GTMetric is telling you what you think it is telling you. – Andy Macaulay-Brook Apr 7 '18 at 9:17
  • not sure what the question is. If you want cookie free requests, just don't set cookies. – Mark Kaplun Apr 7 '18 at 9:17
  • 1
    your problem is using GTMatrix (pagespeed is not better). It gives you irrelevant scores, in the sense that to implement the suggestions in wordpress will require either much coding effort or will create annoyance in the editing flow. To do what they recommend you need to use a different domain or subdaim for your static resources, which is what they are actually checking, and they give you a recomendation based on the possibility that you might have set cookies, which you don't.... the recomendations of those tools need to be taken with many grains of salt – Mark Kaplun Apr 7 '18 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.