the_author_{$field}
云策文档标注
概述
本文档介绍了 WordPress 中的动态过滤器 the_author_{$field},用于过滤用户元数据的值。该过滤器名称基于 $field 参数动态生成,允许开发者在输出用户元数据时进行自定义处理。
关键要点
- 过滤器名称是动态的,格式为 the_author_{$field},其中 $field 是用户元数据的字段名。
- 主要参数包括 $author_meta(元数据值)和 $user_id(用户 ID,可能为 false)。
- 该过滤器通过 apply_filters 调用,常用于 the_author_meta() 函数中,以输出或修改用户元数据。
- 自 WordPress 2.8.0 版本引入,是作者模板功能的一部分。
原文内容
Filters the value of the requested user metadata.
Description
The filter name is dynamic and depends on the $field parameter of the function.
Parameters
$author_metastring-
The value of the metadata.
$user_idint|false-
The user ID.
Source
echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |