Actually I found what I need. Using the action lostpassword_post I can add errors before wordpress checks if the username or email is valid. It does not stop wordpress from checking if the username or email is empty, but still it will do the job.
This is a simplified version of the code that checks my custom field:
add_action('lostpassword_post', 'my_validate_lost_pass_form');
function my_validate_lost_pass_form($errors)
{
if ($_POST['my_field']!='valid-data')
$errors->add( 'my_error_name', "<strong>ERROR</strong>: Access denied." );
return $errors;
}
Related Posts:
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- Is there any action filter/hook for validating a custom field before publishing the post?
- Filter WP_Query for posts having a certain meta-value
- Apply the_content filter to a custom field with multiple values
- Pass all custom fields through the same filter on post load?
- Correct Approach for Validating Custom Field Input
- Filter results with custom field values and dropdown
- Archive sorting functions by custom fields (front-end)
- Show User Their Password
- Change content before writing to database
- WordPress Search Custom Meta Field Only
- How to make custom comment fields required and message field not required
- How to reload the role specific registration form on validation errors?
- How do I assign this filter to a variable? (Appending php & markup to the_content)
- Using custom fields in a filter hook
- Add an advert every nth Paragraph
- How to filter a dd/mm/yyyy date from a custom field in a query
- Force hide custom field metaboxes
- Saving custom profile fields
- Update posts after populating ACF field value [closed]
- filtering custom post types via meta data drop down
- global function to apply filter to custom field
- Validate data on attachment_fields_to_save
- How to order posts by one custom field and filter them by another one?
- Filter multiple custom fields Values with Check boxes
- How to get categories with posts by custom field value?
- How to Wrote Simple Calculations by Using Custom Fields in Loop?
- Warn user that data may be lost for custom pages
- Best filter to use for modifying custom fields on a post?
- How to display childrens custom fields?
- How to add fields in custom registration form, validate it and aave to db? [closed]
- Access ACF fields within custom preview function?
- Sort posts by clicks on download button
- Let Users Filter Posts by Custom Fields
- How to validation for sanitize_URL?
- Custom Theme Fields in Settings Menu – apply filters to one of those fields?
- Footnotes in custom fields
- How to change permalink on headlines in rss feeds?
- How to change order of posts in admin
- How to query posts by month based on date custom field?
- Filter or order based on custom field
- How to show ACF fields in Gridbuilder custom block
- Making custom meta box required (with error message if not filled in) on Gutenberg
- WP meta_query args not working in function
- User Filter Options on Archive Page
- How to add content with a filter when there’s no content in the editor
- How to format the various types of custom fields?
- change attachment custom field onChange event
- Filter and display a specific custom field value [closed]
- How to filter post using custom feild value in shortest and longest duration?
- Query Posts Via WordPress URL
- Validating custom meta boxes with jQuery results in posts being saved as draft instead of published post
- Create widget that filters posts on current page based on entered value
- Including inline Custom Fields info with add_filter in functions.php
- Sort posts after filtering them through multiple taxonomies
- Set new url from custom post field
- Set post status to draft after validating post meta values in save_post hook
- Advanced Custom Fields: how do I check to see if a value is set in an field? [closed]
- WP_Query – Order results by meta value
- getting all values for a custom field key (cross-post)
- How to add a custom field in the advanced menu properties?
- Custom query with orderby meta_value of custom field
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Using meta query (‘meta_query’) with a search query (‘s’)
- Can I exclude a post by meta key using pre_get_posts function?
- Add validation and error handling when saving custom fields?
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Show Custom Fields in Quick Edit
- Where are custom field values stored in the database
- Validating Custom Meta Box Values & Required Fields
- Max length of meta_value
- Add custom fields to wp native gallery settings
- How to fix missing custom fields after upgrading to WordPress 4.8.1?
- don’t publish custom post type post if a meta data field isn’t valid
- How to enable custom fields for pages (if not a bad practice)?
- How can I add extra attribute in the ‘Page Attribute’ section in wp-admin for pages?
- Is there a way to set default custom fields when creating a post?
- Custom post meta field effect on the performance on the post
- How to get custom post meta using REST API
- Custom field/meta populated by dropdown of existing posts?
- Difference between meta keys with _ and without _ [duplicate]
- Filter by one custom field, order by another?
- Remove Dimension from wp_get_attachment_image
- Orderby meta_value only returns posts that have existing meta_key
- Underscores in custom fields
- What is the index [0] for on post meta fields?
- What is “meta_input” parameter in wp_insert_post() used for?
- Sanitize and data validation with apply_filters() function
- Query Posts or Get Posts by custom fields, possible?
- How to validate custom fields in custom post type?
- How to enable revisions for post meta data?
- Sortable Custom Columns in User Panel (users.php)?
- Any way to add custom options to Gallery Settings?
- The “_encloseme” Meta-Key Conundrum
- ORDER BY custom field value
- Individual Widgets per Page
- Add subtitle to Woocommerce product title
- How to protect pages with double authentication: password + email (in custom field)
- Best way to programmatically remove a category/term from a post
- Importing data for advanced custom fields plugin?