You need to add , 10, 3
after your closure to set the hook priority and (more importantly) the number of accepted arguments – otherwise $user_email
and $errors
will not be passed.
add_action( 'register_post', function ( $user_login, $user_email, $errors ) {
$userIsValid = ValidateUser::make($errors);
if(!$userIsValid) {
$errors->add( 'bad_email_domain', '<strong>ERROR</strong>: errors' );
}
}, 10, 3 );
Update: The register_post
hook only fires inside register_new_user()
, which is only used for user registration via the WordPress login page.
To handle errors within the admin (i.e. Users > Add New) use the user_profile_update_errors
hook instead.
Related Posts:
- How to add a new product type on woocommerce product types? [closed]
- WordPress hook before inserting post into database
- Making Custom Fields Standard in the Admin UI
- Check for and enforce unique value in user-entered custom meta field in WP Admin
- Add custom html to last sub-menu item
- Why isn’t is_home() working correctly?
- Any Hook Called When Post Becomes Published?
- When using the block.getSaveElement hook can you output different markup based on whether or not you are in the edit view or the live page view?
- generate unique number when registering a user
- How to exclude certain widget from showing up on home/front page? [duplicate]
- Adding extra info via GET while registeration in wordpress
- Print shortcode in custom action hook not where the shortcode is entered
- Many users with strange names register, but don’t leave comments. Should I be afraid?
- Disable email field on WooCommerce customer account details
- Schedule cron event from widget
- Customizing the default logout page of WordPress
- Is there a filter hook that I can use to change how taxonomy term names are displayed?
- Edit admin post page
- How to pass external variables to the wp_new_user_notification_email filter?
- Add Div to Comment Form
- Add custom user profile field to default WordPress MultiSite registration form
- What’s wrong with Customizing new user notification email by add_filter?
- Function to allow “Anyone can register”?
- I want to submit multiple users if checkbox is checked
- Viewing checkout page removes fees from mini cart
- user_profile_update_errors hook not executing
- How Can I Move Data From Form 1 To Form 2
- Unable to sanitize in customizer and escape in theme without removing ability for user to use “< br >” to insert a line break
- Auto login from custom registration form
- Diffrent User registration form for doctor and patient
- Add Field to WordPress Register Form
- Custom login and registration forms
- How to append custom text to the output of ‘categories widget’?
- How to load a mycred hook from a plugin?
- WooCommer Product Category Loop – How to change the display order of the rating and price?
- Create Unique ID for user
- Custom Register Link on Backend Form
- Customize Widget Navigation
- How to change the login page without a plugin and not only customizing logo and text around the form?
- How to make WordPress search page use a relative path
- How can Use custom input field in functions.php page?
- customer specific email attachment
- Check get_post value after wp-admin login
- How to append the excerpt to the content in the single post page?
- How to display all post from the same current usermeta
- Creating Action Hooks For Automatic File Inclusion
- Customizing the built-in Media Playlist
- Custom user fields validation on registration
- Changing starting number of User ID
- Custom options – register, defaults and delete empty fields (Settings API)
- Which hook should I use for this scenario regarding the registration process and account/profile update?
- add unique code required to register
- User registration add user ID?
- How to get value from wp_usermeta table in database?
- Particle.js not loading in WordPress Gutenberg
- Redirect all pages to the custom login page except for the registration page
- How to change the default registration email ? (plugin and/or non-plugin)
- How to remove admin menu pages inserted by plugins?
- Seamless integration between WordPress and BBpress
- Is there a limit on how much is customizable on WordPress? [closed]
- How to remove Profile Picture section or the message “You can change your profile picture on Gravatar.”
- How do I add a custom HTML attribute to get_avatar?
- Modify custom Users Manage page
- Create subpage /user/ or /my-profile/ like /author/ with additional query like /user/user123
- Customizer: How do you add HTML to control labels?
- show the meta values to visitors that collected via coment form
- Custom URL going to 404
- TinyMCE custom dialog with selectbox not working
- Load more posts with multiple queries
- Suggestions for Implementing a Wedding Website in WordPress?
- Best place for short bio,image and button [closed]
- How to wrap the list with custom class using wp_nav_menu?
- Custom search to display results within same page
- Get ORIGINAL image links from get_post_gallery
- change url for static files in /wp-admin with a cdn url
- CSS Customizations for certain page
- How can I have a common background color across multiple WordPress blocks?
- Get Custom Taxonomy Terms by Date
- Removing blank space below header [closed]
- Archive subtitles for different types of archives
- Point homepage to custom php page
- Adding tags when creating new post
- How can I tag a menu item as visited for each unique user?
- Add Member’s birthdate from Backend and shows it on frontside [closed]
- How to Render Post Types in RSS Feed?
- 404 when Previewing an unsaved draft
- Custom Taxonomy Sort For a Custom Query
- Display a specified content on a Page and all its child pages
- Make the home page template my archive/category page template without code duplication
- How to create multipage form and redirect to specific URL based on inpput?
- remove screenshot.png via dashboard
- Help hooking into user_register
- Overwrite user role
- Accept HTML in custom function
- How to access my WP site locally and publicly? [closed]
- How to customize the gallery shortcode in WordPress?
- Upload files in wordpress
- Using str_replace on wp-admin
- How do I include the sidebar (with Widgets) in a custom theme?
- Copy and Modified WooCommerce function is_coupon_valid [closed]