Action hook 'register_post'

in WP Core File wp-includes/user.php at line 3514

View Source

register_post

Action Hook
Description
Fires when submitting registration form data, before the user is created.

Hook Information

File Location wp-includes/user.php View on GitHub
Hook Type Action
Line Number 3514

Hook Parameters

Type Name Description
string $sanitized_user_login The submitted username after being sanitized.
string $user_email The submitted email.
WP_Error $errors Contains any errors with submitted username and email, e.g., an empty field, an invalid username or email, or an existing username or email.

Usage Examples

Basic Usage
<?php
// Hook into register_post
add_action('register_post', 'my_custom_function', 10, 3);

function my_custom_function($sanitized_user_login, $user_email, $errors) {
    // Your custom code here
}

Source Code Context

wp-includes/user.php:3514 - How this hook is used in WordPress core
<?php
3509  	 * @param string   $user_email           The submitted email.
3510  	 * @param WP_Error $errors               Contains any errors with submitted username and email,
3511  	 *                                       e.g., an empty field, an invalid username or email,
3512  	 *                                       or an existing username or email.
3513  	 */
3514  	do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
3515  
3516  	/**
3517  	 * Filters the errors encountered when a new user is being registered.
3518  	 *
3519  	 * The filtered WP_Error object may, for example, contain errors for an invalid

PHP Documentation

<?php
/**
	 * Fires when submitting registration form data, before the user is created.
	 *
	 * @since 2.1.0
	 *
	 * @param string   $sanitized_user_login The submitted username after being sanitized.
	 * @param string   $user_email           The submitted email.
	 * @param WP_Error $errors               Contains any errors with submitted username and email,
	 *                                       e.g., an empty field, an invalid username or email,
	 *                                       or an existing username or email.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.