Custom WP forms and 404 errors

Recently I’ve been building various custom form plugins for WordPress. And even if it all seemed to work properly I would get an “404 page not found” error instead of my “thank you page”. I know I’m not the only one as this has been reported before.

The reason this happens is basically due to the fact that some form values should NOT be used as they will cause a conflict with the variables passed by WordPress itself. Among them are values like: name, day, year etc.

So, if you are running in to this issue/bug yourself you can isolate the “forbidden” values by simply filling in one value on the form after another and performing a quick submit between each and every one. As soon as you get the 404 error you will know you’ve found one (of potentially several) values you will have to rename.

What you need to do then is give your form field (e.g. text input, textarea or select box) a new name. A field named “year” could then be passed on as “dyear” or similar. Nothing more to it actually.

Please feel free to comment should I’ve left something out, or leave a thank you if I saved you some headaches and time 🙂

Happy coding!

Comments are closed.