get_the_author_(field)
Filters the value of the requested user metadata.
The filter name is dynamic and depends on the $field parameter of the function.
Использование
add_filter( 'get_the_author_(field)', 'wp_kama_get_the_author_field_filter', 10, 3 );
/**
* Function for `get_the_author_(field)` filter-hook.
*
* @param string $value The value of the metadata.
* @param int $user_id The user ID for the value.
* @param int|false $original_user_id The original user ID, as passed to the function.
*
* @return string
*/
function wp_kama_get_the_author_field_filter( $value, $user_id, $original_user_id ){
// filter...
return $value;
}
- $value(строка)
- The value of the metadata.
- $user_id(int)
- The user ID for the value.
- $original_user_id(int|false)
- The original user ID, as passed to the function.
Список изменений
| С версии 2.8.0 | Введена. |
| С версии 4.3.0 | The $original_user_id parameter was added. |
Где вызывается хук
get_the_author_(field)
wp-includes/author-template.php 195
return apply_filters( "get_the_author_{$field}", $value, $user_id, $original_user_id );