wp_pre_insert_user_data WordPress Filter Hook

The wp_pre_insert_user_data hook is fired before a new user is created in the database. It allows you to modify the user data before it is inserted into the database.

apply_filters( 'wp_pre_insert_user_data', array $data, bool $update, int|null $user_id, array $userdata ) #

Filters user data before the record is created or updated.


Description

It only includes data in the users table, not any user metadata.


Top ↑

Parameters

$data

(array)Values and keys for the user.

  • 'user_login'
    (string) The user's login. Only included if $update == false
  • 'user_pass'
    (string) The user's password.
  • 'user_email'
    (string) The user's email.
  • 'user_url'
    (string) The user's url.
  • 'user_nicename'
    (string) The user's nice name. Defaults to a URL-safe version of user's login
  • 'display_name'
    (string) The user's display name.
  • 'user_registered'
    (string) MySQL timestamp describing the moment when the user registered. Defaults to the current UTC timestamp.

$update

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

$user_id

(int|null)ID of the user to be updated, or NULL if the user is being 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.9.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