I recently had a problem with a form submitted in WordPress returning a 404 error everytime even though it was submitting to an entirely valid URL. The form submission was managed via AJAX using
It turns out that WordPress has a number of query variable names that are reserved for specific functions and cannot be used by any custom form on the site. In my case, I had a field called ‘name’ that was the culprit and simply changing it to ‘clientname’ fixed my problem entirely. The problem is that instead of giving a helpful error, WordPress just returns a 404 with no explanation about what went wrong or why it happened – even with debug mode on there is nothing helpful. This, as you can imagine, is particularly frustrating.
I haven’t found any official documentation listing the reserved variables, but there is this user-created page in the WordPress Codex that has a list of them (based on the variables used by WP_Query). I’m not sure how complete it is, but it seems fairly comprehensive.
Seeing as though I struggled with this for a few days, I thought I would share the solution here to help anyone else who might be having a similar issue.