Filter hook 'pre_user_first_name'

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

View Source

pre_user_first_name

Filter Hook
Description
Filters a user's first name before the user is created or updated.

Hook Information

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

Hook Parameters

Type Name Description
string $first_name The user's first name.

Usage Examples

Basic Usage
<?php
// Hook into pre_user_first_name
add_filter('pre_user_first_name', 'my_custom_filter', 10, 1);

function my_custom_filter($first_name) {
    // Your custom filtering logic here
    return $first_name;
}

Source Code Context

wp-includes/user.php:2372 - How this hook is used in WordPress core
<?php
2367  	 *
2368  	 * @since 2.0.3
2369  	 *
2370  	 * @param string $first_name The user's first name.
2371  	 */
2372  	$meta['first_name'] = apply_filters( 'pre_user_first_name', $first_name );
2373  
2374  	$last_name = empty( $userdata['last_name'] ) ? '' : $userdata['last_name'];
2375  
2376  	/**
2377  	 * Filters a user's last name before the user is created or updated.

PHP Documentation

<?php
/**
	 * Filters a user's first name before the user is created or updated.
	 *
	 * @since 2.0.3
	 *
	 * @param string $first_name The user's first name.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.