钩子文档

user_{$name}_label

💡 云策文档标注

概述

user_{$name}_label 是一个 WordPress 过滤器钩子,用于动态过滤用户联系方法标签。它允许开发者自定义特定联系方法的可翻译标签。

关键要点

  • 这是一个动态钩子,$name 对应联系方法数组中的键名。
  • 参数 $desc 是联系方法的可翻译标签字符串。
  • 钩子通过 apply_filters 调用,用于修改标签显示。

代码示例

echo apply_filters( "user_{$name}_label", $desc );

注意事项

  • 钩子自 WordPress 2.9.0 版本引入。
  • 使用时需确保 $name 与联系方法数组中的键匹配。

📄 原文内容

Filters a user contactmethod label.

Description

The dynamic portion of the hook name, $name, refers to each of the keys in the contact methods array.

Parameters

$descstring
The translatable label for the contact method.

Source

echo apply_filters( "user_{$name}_label", $desc );

Changelog

Version Description
2.9.0 Introduced.