wp_get_user_contact_methods( WP_User|null $user = null ): string[]

Sets up the user contact methods.

Description

Default contact methods were removed for new installations in WordPress 3.6 and completely removed from the codebase in WordPress 6.9.

Use the ‘user_contactmethods’ filter to add or remove contact methods.

Parameters

$userWP_User|nulloptional
WP_User object.

Default:null

Return

string[] Array of contact method labels keyed by contact method.

Source

function wp_get_user_contact_methods( $user = null ) {
	$methods = array();

	/**
	 * Filters the user contact methods.
	 *
	 * @since 2.9.0
	 *
	 * @param string[]     $methods Array of contact method labels keyed by contact method.
	 * @param WP_User|null $user    WP_User object or null if none was provided.
	 */
	return apply_filters( 'user_contactmethods', $methods, $user );
}

Hooks

apply_filters( ‘user_contactmethods’, string[] $methods, WP_User|null $user )

Filters the user contact methods.

Changelog

VersionDescription
6.9.0Removed references to aim, jabber, and yim contact methods.
3.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.