I really hope I've got a simple issue in front of me here, as it's sort of driving me up a wall.
Short story: submitting a simple form on the front end of the site results in a 302 Found
redirect, totally stripping the $_POST
data in the process.
Scenario:
- Create a page in the admin called Edit
- Create a custom template file (ie,
my-edit-template.php
) and apply it to Edit
my-edit-template.php:
<?php
/**
* Template Name: My Edit Template
*/
if ($_POST['action']) {
var_dump($_POST);
}
get_header(); ?>
<form action="" method="post">
<input name="my-ornery-field" value="">
<input type="submit" value="submit">
<input type="hidden" id="action" name="action" value="update-profile">
</form>
<?php get_footer(); ?>
Now, when I submit the form, I get two requests to the same page, first, the POST
, with the form data intact, and second, a GET
(status code 200
), obviously stripped of the $_POST
global, or anything useful to me.
I'm sure this is a total oversight, but I'm at a loss; utterly confused.
I've tried:
- All plugins disabled
- Flushing rewrites back to basic defaults
POST
ing via Javascript/XHR
Help?
I'm sorry if the details are sparse, I'm sort of in class right now, but I'll follow-up with anything else relevant, later.