user_contactmethods
Filters the user contact methods.
Usage
add_filter( 'user_contactmethods', 'wp_kama_user_contactmethods_filter', 10, 2 );
/**
* Function for `user_contactmethods` filter-hook.
*
* @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 string[]
*/
function wp_kama_user_contactmethods_filter( $methods, $user ){
// filter...
return $methods;
}
- $methods(string[])
- Array of contact method labels keyed by contact method.
- $user(WP_User|null)
- WP_User object or null if none was provided.
Changelog
| Since 2.9.0 | Introduced. |
Where the hook is called
user_contactmethods
wp-includes/user.php 2997
return apply_filters( 'user_contactmethods', $methods, $user );