insert_user_meta WordPress Filter Hook

insert_user_meta is a Wordpress hook that is called when a user meta data is inserted. It allows you to modify or add to the user meta data that is being inserted.

apply_filters( 'insert_user_meta', array $meta, WP_User $user, bool $update, array $userdata ) #

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.


Top ↑

Parameters

$meta

(array)Default meta values and keys for the user.

  • 'nickname'
    (string) The user's nickname. Default is the user's username.
  • 'first_name'
    (string) The user's first name.
  • 'last_name'
    (string) The user's last name.
  • 'description'
    (string) The user's description.
  • 'rich_editing'
    (string) Whether to enable the rich-editor for the user. Default 'true'.
  • 'syntax_highlighting'
    (string) Whether to enable the rich code editor for the user. Default 'true'.
  • 'comment_shortcuts'
    (string) Whether to enable keyboard shortcuts for the user. Default 'false'.
  • 'admin_color'
    (string) The color scheme for a user's admin screen. Default 'fresh'.
  • 'use_ssl'
    (int|bool) Whether to force SSL on the user's admin area. 0|false if SSL is not forced.
  • 'show_admin_bar_front'
    (string) Whether to show the admin bar on the front end for the user. Default 'true'.
  • 'locale'
    (string) User's locale. Default empty.

$user

(WP_User)User object.

$update

(bool)Whether the user is being updated rather than created.

$userdata

(array)The raw array of data passed to wp_insert_user().


Top ↑

Source

File: wp-includes/user.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.8.0The $userdata parameter was added.
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More