user_contactmethods
Filter HookDescription
Filters the user contact methods.Hook Information
File Location |
wp-includes/user.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2964 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$methods
|
Array of contact method labels keyed by contact method. |
WP_User|null
|
$user
|
WP_User object or null if none was provided. |
Usage Examples
Basic Usage
<?php
// Hook into user_contactmethods
add_filter('user_contactmethods', 'my_custom_filter', 10, 2);
function my_custom_filter($methods, $user) {
// Your custom filtering logic here
return $methods;
}
Source Code Context
wp-includes/user.php:2964
- How this hook is used in WordPress core
<?php
2959 * @since 2.9.0
2960 *
2961 * @param string[] $methods Array of contact method labels keyed by contact method.
2962 * @param WP_User|null $user WP_User object or null if none was provided.
2963 */
2964 return apply_filters( 'user_contactmethods', $methods, $user );
2965 }
2966
2967 /**
2968 * The old private function for setting up user contact methods.
2969 *
PHP Documentation
<?php
/**
* 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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.