insert_user_meta хук-фильтрWP 4.4.0

Filters a user's meta values and keys immediately after the user is created or updated and before any user meta is inserted or updated.

Does not include contact methods. These are added using wp_get_user_contact_methods($user).

For custom meta fields, see the insert_custom_user_meta filter.

Использование

add_filter( 'insert_user_meta', 'wp_kama_insert_user_meta_filter', 10, 4 );

/**
 * Function for `insert_user_meta` filter-hook.
 * 
 * @param array   $meta     Default meta values and keys for the user.
 * @param WP_User $user     User object.
 * @param bool    $update   Whether the user is being updated rather than created.
 * @param array   $userdata The raw array of data passed to wp_insert_user().
 *
 * @return array
 */
function wp_kama_insert_user_meta_filter( $meta, $user, $update, $userdata ){

	// filter...
	return $meta;
}
$meta(массив)

Default meta values and keys for the user.

  • nickname(строка)
    The user's nickname.
    По умолчанию: user's username

  • first_name(строка)
    The user's first name.

  • last_name(строка)
    The user's last name.

  • description(строка)
    The user's description.

  • rich_editing(строка)
    Whether to enable the rich-editor for the user.
    По умолчанию: 'true'

  • syntax_highlighting(строка)
    Whether to enable the rich code editor for the user.
    По умолчанию: 'true'

  • comment_shortcuts(строка)
    Whether to enable keyboard shortcuts for the user.
    По умолчанию: 'false'

  • admin_color(строка)
    The color scheme for a user's admin screen.
    По умолчанию: 'fresh'

  • use_ssl(int|true|false)
    Whether to force SSL on the user's admin area. 0|false if SSL is not forced.

  • show_admin_bar_front(строка)
    Whether to show the admin bar on the front end for the user.
    По умолчанию: 'true'

  • locale(строка)
    User's locale.
    По умолчанию: ''
$user(WP_User)
User object.
$update(true|false)
Whether the user is being updated rather than created.
$userdata(массив)
The raw array of data passed to wp_insert_user().

Список изменений

С версии 4.4.0 Введена.
С версии 5.8.0 The $userdata parameter was added.

Где вызывается хук

wp_insert_user()
insert_user_meta
wp-includes/user.php 2378
$meta = apply_filters( 'insert_user_meta', $meta, $user, $update, $userdata );

Где используется хук в WordPress

Использование не найдено.