insert_custom_user_meta хук-фильтрWP 5.9.0

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

For non-custom meta fields, see the insert_user_meta filter.

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

add_filter( 'insert_custom_user_meta', 'wp_kama_insert_custom_user_meta_filter', 10, 4 );

/**
 * Function for `insert_custom_user_meta` filter-hook.
 * 
 * @param array   $custom_meta Array of custom user meta values keyed by meta key.
 * @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_custom_user_meta_filter( $custom_meta, $user, $update, $userdata ){

	// filter...
	return $custom_meta;
}
$custom_meta(массив)
Array of custom user meta values keyed by meta key.
$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().

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

С версии 5.9.0 Введена.

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

wp_insert_user()
insert_custom_user_meta
wp-includes/user.php 2398
$custom_meta = apply_filters( 'insert_custom_user_meta', $custom_meta, $user, $update, $userdata );

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

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