user_{$field}
Filter HookDescription
Filters the value of a user field in a standard 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 | 1949 |
Hook Parameters
Type | Name | Description |
---|---|---|
mixed
|
$value
|
The user object value to sanitize. |
int
|
$user_id
|
User ID. |
string
|
$context
|
The context to filter within. |
Usage Examples
Basic Usage
<?php
// Hook into user_{$field}
add_filter('user_{$field}', 'my_custom_filter', 10, 3);
function my_custom_filter($value, $user_id, $context) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/user.php:1949
- How this hook is used in WordPress core
<?php
1944 *
1945 * @param mixed $value The user object value to sanitize.
1946 * @param int $user_id User ID.
1947 * @param string $context The context to filter within.
1948 */
1949 $value = apply_filters( "user_{$field}", $value, $user_id, $context );
1950 }
1951 }
1952
1953 if ( 'user_url' === $field ) {
1954 $value = esc_url( $value );
PHP Documentation
<?php
/**
* Filters the value of a user field in a standard 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 The user object value to sanitize.
* @param int $user_id User ID.
* @param string $context The context to filter within.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.