user_(field)
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.
Использование
add_filter( 'user_(field)', 'wp_kama_user_field_filter', 10, 3 ); /** * Function for `user_(field)` filter-hook. * * @param mixed $value The user object value to sanitize. * @param int $user_id User ID. * @param string $context The context to filter within. * * @return mixed */ function wp_kama_user_field_filter( $value, $user_id, $context ){ // filter... return $value; }
- $value(разное)
- The user object value to sanitize.
- $user_id(int)
- User ID.
- $context(строка)
- The context to filter within.
Список изменений
С версии 2.9.0 | Введена. |
Где вызывается хук
wp-includes/user.php 1871
$value = apply_filters( "user_{$field}", $value, $user_id, $context );
Где используется хук в WordPress
wp-admin/includes/admin-filters.php 112
add_action( 'user_register', array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
wp-admin/includes/ms-admin-filters.php 14
add_action( 'user_admin_notices', 'new_user_email_admin_notice' );
wp-includes/default-filters.php 423
add_action( 'user_request_action_confirmed', '_wp_privacy_account_request_confirmed' );
wp-includes/default-filters.php 424
add_action( 'user_request_action_confirmed', '_wp_privacy_send_request_confirmation_notification', 12 ); // After request marked as completed.
wp-includes/default-filters.php 713
add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 );
wp-includes/default-filters.php 714
add_filter( 'user_has_cap', 'wp_maybe_grant_resume_extensions_caps', 1 );
wp-includes/default-filters.php 715
add_filter( 'user_has_cap', 'wp_maybe_grant_site_health_caps', 1, 4 );