Filter hook 'pre_user_{$field}'

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

View Source

pre_user_{$field}

Filter Hook
Description
Filters the value of a user field in the 'db' context. The dynamic portion of the hook name, `$field`, refers to the prefixed user field being filtered, such as 'user_login', 'user_email', 'first_name', etc.

Hook Information

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

Hook Parameters

Type Name Description
mixed $value Value of the prefixed user field.

Usage Examples

Basic Usage
<?php
// Hook into pre_user_{$field}
add_filter('pre_user_{$field}', 'my_custom_filter', 10, 1);

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

Source Code Context

wp-includes/user.php:1927 - How this hook is used in WordPress core
<?php
1922  			 *
1923  			 * @since 2.9.0
1924  			 *
1925  			 * @param mixed $value Value of the prefixed user field.
1926  			 */
1927  			$value = apply_filters( "pre_user_{$field}", $value );
1928  		}
1929  	} else {
1930  		// Use display filters by default.
1931  		if ( $prefixed ) {
1932  

PHP Documentation

<?php
/**
			 * Filters the value of a user field in the 'db' context.
			 *
			 * The dynamic portion of the hook name, `$field`, refers to the prefixed user
			 * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
			 *
			 * @since 2.9.0
			 *
			 * @param mixed $value Value of the prefixed user field.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.