Skip to content

Function

Filter the user data before it is inserted by wp_insert_user().

tml_ms_filter_pre_insert_user_data( array $data = array(), bool $update = false )

Parameters

$data array Default array()
The user data to insert.
$update bool Default false
Whether an existing user is being updated.

Return

array The user data to insert.

Source

function tml_ms_filter_pre_insert_user_data( $data = array(), $update = false ) {
    if ( $update ) {
        return $data;
    }

    $password = tml_ms_get_activation_password();
    if ( '' !== $password ) {
        $data['user_pass'] = wp_hash_password( $password );
    }

    return $data;
}

Uses

Changelog

VersionDescription
7.0 Introduced.
7.2.2 Added the <code>$update</code> parameter.