Warning: Trying to access array offset on value of type bool in /var/www/vhosts/tomelliott.com/httpdocs/wp-content/themes/tomelliott/single.php on line 12

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.


  • 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?

    • Tom Elliott says:

      Hi Jordan, you’ll have to check you’re theme’s source files for a form field with the ‘name’ name. Could well be in single.php or page.php

  • 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!

  • Luke says:

    Thank you!!

  • Ivan says:

    You just saved me tons of hours of trying to find out what I got wrong.
    Really appreciated mate, keep up the good work.

  • Juru says:

    UNFUCKING BELIEVABLE! For 2 days I am trying to fix this bug with the redirect. Thank you!!!