Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my WP site I've got a Contact page whose URL is mysite.com/contact/ and which contains a <form> with an action attribute set to action="/contact/"

Clicking on the submit button brings me to this : mysite.com/contact/

This is the exact URL of my contact page (which works very well if I use this URL). Yet, it gives a 404 after having arrived to that URL via the submit button !

This doesn't make any sense to me, anybody can explain?

share|improve this question
    
What's the form's method? Using a method of GET will result in additional query variables being appended, one of which might be interfering with WordPress rewrite system. Try it with the method set to POST and see if it works. –  goldenapples May 15 '11 at 0:46
    
are you using any form plugin, if not then how you are using that form? –  Hameedullah Khan May 15 '11 at 15:49
add comment

migrated from stackoverflow.com May 14 '11 at 23:54

This question came from our site for professional and enthusiast programmers.

2 Answers

To make the answer more complete, there is another case which will generate a 404 except using generic words in the name-attribute: When you give the submit button a name attribute with ANY value, it will always redirect to a 404. So never use a name-attribute on input type='submit'

share|improve this answer
1  
This is not true. Do you have an example? –  toscho Dec 20 '12 at 12:46
add comment

You're probably using an input field that contains name="name". A lot of generic words are used by WordPress itself (incl. name, so a best practise is to always prefix_ your fields, like name="prefix_name".

share|improve this answer
    
in my case I had an input with name='s' that was generating an annoying 404, thanks for the tip –  cbaigorri Jan 20 '12 at 19:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.