I am just creating a simple contact form, but I notice that it seems to post to an invalid page. The url in the browser is correct but the title of the page is "Page not found"

on the top of the page

$emailed = false;
if (isset($_POST['submit'])) {
    wp_mail('example@example.com', $_POST['subject'], $_POST['content']);
    $emailed = true;

below ... the HTML:

<form action="<?php the_permalink(); ?>" method="post" id="contactform">
    <div class="formelem">
        <label for="name">Name</label>
        <input type="text" name="name" class="required" />
    <div class="formelem">
        <label for="email">Email</label>
        <input type="text" name="email" class="required email" />
    <div class="formelem">
        <label for="subject">Subject</label>
        <input type="text" name="subject" class="required" />
    <div class="formelem">
        <label for="content">Content</label>
        <textarea name="content" cols="30" rows="10" class="required"></textarea>

    <input type="submit" value="Submit Message" name="submit" value="submit" />
  • 2
    What URL is your page located? Mar 11, 2011 at 9:18
  • The same issue appears if you use WooCommerce Subscriptions and you have input field, named "subscriptions". It took me quite a long time to figure out what's going on and I managed to fix it thanks to this post. I hope that someone using WooCommerce Subscriptions and have a similar issue finds that helpful!
    – Whiplash
    Jun 11, 2019 at 14:41

5 Answers 5


I could be wrong, but I vaguely remember that: name, email get hijacked by WordPress to do post comments, if you renamed the form elements to be contact-name and contact-email, do you get the same issue?

  • 1
    Yea it's the name field, namespace it like jm_name instead :)
    – Backie
    Mar 11, 2011 at 13:16
  • Thanks Tom! WP was indeed hijacking the form. That's strange. Nov 4, 2016 at 21:30
  • This is also true for AngularJS, in case that helps. ;)
    – Mark
    Sep 13, 2018 at 20:36
  • I faced this issue, this answer directed me to right path. I had no field with name or email, but one of input name was equal to custom post type (cpt) so it was triggering the wp query and 404. So i changed the field name to make it different than cpt, and it fixed the issue.
    – Mohsin
    May 28, 2019 at 17:42
  • Horrible, when using the input field name email not able to insert data. Thanks Helped me
    – Arman H
    Jul 9, 2020 at 3:32

It is no only name or email problem, as Tom wrote. I had problem even with input field with name attribute same as one of my Custom Post Types. For example:

<input type="text" name="movie">

And when having registered CPT "movie" somewhere else, your form submitting will end with 404 error.

Conclusion: Don't use name, email and any registered custom post type handle as input name attribute value in your forms.

  • Well, I tried to answer original question with more accurate information. Ehm, probably... :-) Adding a little edit.
    – Marek
    Nov 18, 2014 at 15:38
  • Also, custom taxonomy names are not allowed as input names
    – Marc
    Mar 26, 2020 at 13:30
  • Yes, there is a big list. You can find help from here: infinitypp.com/wordpress/… Jul 29, 2020 at 19:26

Try to change name="email" to something like name="my_theme_email", do the same with all your field it sounds like some name are reserved with WordPress when sending form data. I got the the same problem and I fixed it like that.


It works to me, just changed your

input type name, email, subject, and content to any name as names, emails, subjects, contents.

It will work. Thanks.


Also you can not use year as the name of the field.

  • Which field? Are you passing the year field as a query string parameter or as a field in a posted form? I'd be surprised if this was a general problem.
    – Rup
    May 23, 2021 at 0:06
  • Field in a posted form. <input type="text" name="year"/> May 29, 2021 at 9:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.