Filter hook 'pre_user_nickname'

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

View Source

pre_user_nickname

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

Hook Information

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

Hook Parameters

Type Name Description
string $nickname The user's nickname.

Usage Examples

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

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

Source Code Context

wp-includes/user.php:2361 - How this hook is used in WordPress core
<?php
2356  	 *
2357  	 * @since 2.0.3
2358  	 *
2359  	 * @param string $nickname The user's nickname.
2360  	 */
2361  	$meta['nickname'] = apply_filters( 'pre_user_nickname', $nickname );
2362  
2363  	$first_name = empty( $userdata['first_name'] ) ? '' : $userdata['first_name'];
2364  
2365  	/**
2366  	 * Filters a user's first name before the user is created or updated.

PHP Documentation

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

Related hooks will be displayed here in future updates.