Submitting a form in WordPress redirects to 404 page

01 September, 2013 by Tom Elliott

I came across an interesting bug on a bespoke WordPress site’s contact form recently, whereby submitting the form details took me straight to the 404 not found page, instead of the form’s action URL.

After a bit of tinkering, I figured out the problem was down to using the word ‘name’ as one of the form field’s input ID. Changing the form field from ‘name’ to ‘form_name’ fixed the issue and the form redirected to the target URL.

This 404 redirect issue is due to the fact that WordPress uses a number of reserved strings for various functions and commands and ‘name’ is one of them. It’s a good idea to attach a prefix such as ‘form_’ to the IDs of all your form fields, so there’s no risk of running into this problem.



10 Comments

  • George says:

    Tom Elliott,
    Thanks for the solution

  • Adam says:

    attachment is one of them as well. It was driving me insane!

  • Jordan says:

    Where do I have to go to change the form name?

  • Rob says:

    Thanks for this. What an irritating bug! There are other terms that also break this, like “service”. I stumble across this every once an a while and forget and have to search for the solution again…

  • Thomas Dufranne says:

    You save my day !

  • Ariel says:

    you are the best of the best, I was with this problem many hours trying everything, thank you very much from Argentina

  • saurabh says:

    You are awesome, lot of thanks to you.

  • Sim says:

    Just giving this some 2016 love to try and keep it relevant. Worked like a charm – I’ve been stuck on this for ages!

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    css.php