lostpassword_post
lostpassword_post is an action that is fired when the lost password form in wp-login.php is submitted. Use it to get and process the results of any fields you add to the lost password form via lostpassword_form.
If you wish to halt the processing of the form submit, then you need to make the $errors array a global within your function and then add your error message to it. The key name is not important.
Example usage:
Context:
File: /wp-content/plugins/yourplugin.php
add_action('lostpassword_form', yourplugin_form');
add_action('lostpassword_post', 'yourplugin_post');
function yourplugin_form() {
/* Output an input field here */
}
function yourplugin_post() {
global $errors;
if ( empty( $_POST['yourfield'] ) ) {
$errors['yourplugin'] = 'ERROR: You need to fill in the [description] field!';
} else {
// Do something with the field results here, like save it to the database
}
}
This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn't return, and shouldn't take any parameters
This hook is an action which means that it primarily acts as an event trigger, instead of a content filter. This is a semantic difference, but it will help you to remember what this hook does if you use it like this: add_action('lostpassword_post', 'your_function');
This hook was introduced in WordPress 2.1, and will not work in earlier versions.