I’m looking for a simple way for a WordPress plugin to process $_POST
data from a user submitted form. Back end processing will be performed and then I’ll redirect to a new page as appropriate — so during processing there is no UI.
Basically, I want to take a form submit such as…
<form method="post" action="/back-end-processing.php">
<input type="text" name="text" />
<input type="submit" value="submit" />
</form>';
…and process it like I would with PHP but still be able to use WP’s “nonce” protection.
Some examples I’ve seen suggest that I should use admin-post.php
but I was concerned that it should only be used for actual admins and not for general users.
Another approach suggested…
function checkCheckBox()
{
if($_POST['checkbox'] == 1)
{
return true;
}
return false;
}
add_action('init', 'checkCheckBox');
…however, this seems like overkill because it will be called for every page while my site visitors will only be posting data to it infrequently.