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
- Custom post meta field effect on the performance on the post
- Having different sidebar content for MANY pages?
- Plugins won’t recognize my plugin’s hidden custom fields
- If value present, order posts by two consecutive custom fields
- Save page data to an xml file
- Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields
- How to save a ToggleControl value in a meta field?
- How do I use Ajax to build a dropdown of custom fields based on a post selected in previous dropdown?
- Register rest field for specific user
- Custom Field Suite A little problem
- Meta query with timestamp using WP_query
- Passing Custom Field Data as Array to be Saved (Resulting Custom Field Array is inconsistent)
- load custom fields on click
- Auto-remove custom field with no value on publish
- Custom Fields box in the post editor: Replace textareas with input elements
- Hide custom meta data if empty
- How to get latest post value if first post is empty in wordpress
- Custom fields attached to a page template only show on edit screen when page is saved
- Value from custom field is not being displayed?
- Can I access a post meta field before the loop?
- wrap text around custom fields array
- Show image if author meta (profile fields) exists outside loop
- How can i retrive a text from a custom field
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- Buik update custom field values from external API
- Change a custom field value after X number of seconds
- Jquery on custom-field backend
- Filter search posts by post meta?
- Custom fields won’t update
- How to use custom fields like Title to show value in content?
- Populate custom checkout fields with data from previous orders
- Changing form action based on selected value
- Text in header as a page – hide from Web crawlers
- When post is updated, custom metadata in text area field is overwritten
- Custom Fields – How can I remove the publish option for certain users
- Can i categorise my meta box?
- How to overwrite a value for a custom field?
- WordPress archives by custom field and date
- Function to retrieve a picture if there is no picture is attached
- Show posts containing or not custom field
- add_post_meta insert null value into Database
- extra post fields for url + youtube video / implementation
- Add CSS class to posts with certain meta key