钩子文档

user_profile_picture_description

💡 云策文档标注

概述

user_profile_picture_description 是一个 WordPress 过滤器钩子,用于修改 Gravatar 下方显示的用户头像描述文本。它允许开发者自定义描述内容,基于当前用户对象。

关键要点

  • 这是一个过滤器钩子,用于过滤用户头像的描述文本。
  • 接受两个参数:$description(字符串,要打印的描述)和 $profile_user(WP_User 对象,当前用户)。
  • 在 WordPress 4.4.0 版本引入,4.7.0 版本添加了 $profile_user 参数。

代码示例

echo apply_filters( 'user_profile_picture_description', $description, $profile_user );

注意事项

  • 使用此钩子时,确保正确处理 $profile_user 参数以获取用户特定信息。
  • 注意版本兼容性:$profile_user 参数从 4.7.0 开始可用。

📄 原文内容

Filters the user profile picture description displayed under the Gravatar.

Parameters

$descriptionstring
The description that will be printed.
$profile_userWP_User
The current WP_User object.

Source

echo apply_filters( 'user_profile_picture_description', $description, $profile_user );

Changelog

Version Description
4.7.0 Added the $profile_user parameter.
4.4.0 Introduced.