404 errors from admin-ajax.php in WordPress

I am developing a dynamic website and when I stress some of the dynamic functionality I am getting occasional 404 errors from admin-ajax.php.

I am currently developing a minor dynamic website. Towards the end of the development I was stress-testing some of the dynamic functionality.

Unfortunately I am getting occasional 404 errors from admin-ajax.php.

The request seems to be sent and processed because on refresh of the page I can see the updates. However it is a bad user experience because the user’s page just stalls.

After a little troubleshooting, mainly with crude debug statements from admin-ajax.php into HTTP headers, I have noticed that admin-ajax.php is not even entered.

At the moment I am not sure whether the error is related to one of the WordPress plugins I am using or whether it is due to my webhost.

There are no visible errors in weblogs nor in error_log.

One thing I noticed that a new incognito browser window resolved the issue.

This made me suspicious of cookie issues. I manage to narrow it down to the PHPSESSID cookie. Clearing it resolved the issue. The 404 error from admin-ajax.php is gone… for a while at least.

I recommend using the excellent Eat This Cookie extension If you are using Chrome or Brave browser.

The search continues…