WordPress как на ладони
wordpress jino

pre_user_last_name хук-фильтр . WP 2.0.3

Filters a user's last name before the user is created or updated.

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

add_filter( 'pre_user_last_name', 'filter_function_name_11' );
function filter_function_name_11( $last_name ){
	// filter...

	return $last_name;
}
$last_name(string)
The user's last name.

Связи хука

Используется в: wp_insert_user()

Остальные хуки из: wp_insert_user():

Кусок кода с хуком

Фрагмент из: wp-includes/user.php WP 4.7.2
...
	 * @since 2.0.3
	 *
	 * @param string $first_name The user's first name.
	 */
	$meta['first_name'] = apply_filters( 'pre_user_first_name', $first_name );

	$last_name = empty( $userdata['last_name'] ) ? '' : $userdata['last_name'];

	/**
	 * Filters a user's last name before the user is created or updated.
	 *
	 * @since 2.0.3
	 *
	 * @param string $last_name The user's last name.
	 */
	$meta['last_name'] = apply_filters( 'pre_user_last_name', $last_name );

	if ( empty( $userdata['display_name'] ) ) {
		if ( $update ) {
			$display_name = $user_login;
		} elseif ( $meta['first_name'] && $meta['last_name'] ) {
			/* translators: 1: first name, 2: last name */
			$display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $meta['first_name'], $meta['last_name'] );
		} elseif ( $meta['first_name'] ) {
			$display_name = $meta['first_name'];
		} elseif ( $meta['last_name'] ) {
			$display_name = $meta['last_name'];
		} else {
			$display_name = $user_login;
		}
	} else {
...