Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#26828 closed defect (bug) (invalid)

Posting a form with "second" "minute" or "hour" as input names throws 404 error

Reported by: new-nine's profile New Nine Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.8
Component: Query Keywords:
Focuses: Cc:

Description

Create a form on a page or post with an input named "second", "minute", or "hour" and post it (to itself or another page/post). The result is a 404 error.

It doesn't happen on category or tag archives - just singles.

I'm thinking that WordPress is running one of its own form submission validations (maybe it thinks a post is being created?), is finding missing fields, and throws a 404 error.

Marked as trivial because you can simply change the name of your form inputs.

Change History (3)

#1 follow-up: @johnbillion
11 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is because second, minute and hour are reserved query variables used by WordPress. After submitting your form, WordPress is trying to load posts from the corresponding date.

You'll need to change the names of your inputs. Best thing would probably be to prefix them, eg. my_second etc.

See here for a list of reserved query variables.

#2 @ocean90
11 years ago

  • Component changed from HTTP to Query

#3 in reply to: ↑ 1 @New Nine
11 years ago

Replying to johnbillion:

This is because second, minute and hour are reserved query variables used by WordPress. After submitting your form, WordPress is trying to load posts from the corresponding date.

You'll need to change the names of your inputs. Best thing would probably be to prefix them, eg. my_second etc.

See here for a list of reserved query variables.

I figured that but it's worth noting (IMO) for a patch later on if it's possible to not have WordPress check every POST as a potential query, particularly when most queries are launched by clicking links and running through the permalink system via GET.

Couldn't find that list of reserved variables - thanks for that!

Note: See TracTickets for help on using tickets.