apply_filters( 'insert_user_meta', array $meta, WP_User $user, bool $update, array $userdata )
- Since
- 4.4.0, 5.8.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.
Description
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.Parameters
$metaarray- { Default meta values and keys for the user. @type string $nickname The user's nickname. Default is the user's username. @type string $first_name The user's first name. @type string $last_name The user's last name. @type string $description The user's description. @type string $rich_editing Whether to enable the rich-editor for the user. Default 'true'. @type string $syntax_highlighting Whether to enable the rich code editor for the user. Default 'true'. @type string $comment_shortcuts Whether to enable keyboard shortcuts for the user. Default 'false'. @type string $admin_color The color scheme for a user's admin screen. Default 'modern'. @type int|bool $use_ssl Whether to force SSL on the user's admin area. 0|false if SSL is not forced. @type string $show_admin_bar_front Whether to show the admin bar on the front end for the user. Default 'true'. @type string $locale User's locale. Default empty.}
$nicknamestringThe user's nickname. Default is the user's username.$first_namestringThe user's first name.$last_namestringThe user's last name.$descriptionstringThe user's description.$rich_editingstringWhether to enable the rich-editor for the user. Default 'true'.$syntax_highlightingstringWhether to enable the rich code editor for the user. Default 'true'.$comment_shortcutsstringWhether to enable keyboard shortcuts for the user. Default 'false'.$admin_colorstringThe color scheme for a user's admin screen. Default 'modern'.$use_sslint|boolWhether to force SSL on the user's admin area. 0|false if SSL is not forced.$show_admin_bar_frontstringWhether to show the admin bar on the front end for the user. Default 'true'.$localestringUser's locale. Default empty.
$userWP_User- User object.
$updatebool- Whether the user is being updated rather than created.
$userdataarray- The raw array of data passed to wp_insert_user().
Fired at · 1
wp-includes/user.php:2617wp_insert_user()
Source
<?php * @type string $locale User's locale. Default empty. * } * @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(). */ $meta = apply_filters( 'insert_user_meta', $meta, $user, $update, $userdata ); $custom_meta = array(); if ( array_key_exists( 'meta_input', $userdata ) && is_array( $userdata['meta_input'] ) && ! empty( $userdata['meta_input'] ) ) { $custom_meta = $userdata['meta_input']; } History
Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
5.8.0
The
$userdata parameter was added.from the docblock4.4.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.