On this page
wp_get_user_contact_methods( WP_User|null $user = null ): string[]
Sets up the user contact methods.
Description
Default contact methods were removed in 3.6. A filter dictates contact methods.
Parameters
Return
string[] Array of contact method labels keyed by contact method.
Source
File: wp-includes/user.php. View all references
function wp_get_user_contact_methods( $user = null ) {
$methods = array();
if ( get_site_option( 'initial_db_version' ) < 23588 ) {
$methods = array(
'aim' => __( 'AIM' ),
'yim' => __( 'Yahoo IM' ),
'jabber' => __( 'Jabber / Google Talk' ),
);
}
/**
* 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.
Related
Uses
| Uses | Description |
|---|---|
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| get_site_option() wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
Used By
| Used By | Description |
|---|---|
| edit_user() wp-admin/includes/user.php | Edit user settings based on contents of $_POST |
| _get_additional_user_keys() wp-includes/user.php | Returns a list of meta keys to be (maybe) populated in wp_update_user() . |
| _wp_get_user_contactmethods() wp-includes/user.php | The old private function for setting up user contact methods. |
| wp_insert_user() wp-includes/user.php | Inserts a user into the database. |
Changelog
| Version | Description |
|---|---|
| 3.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_get_user_contact_methods