admin_footer_text
云策文档标注
概述
admin_footer_text 是一个 WordPress 过滤器,用于修改管理后台页脚显示的“感谢”文本。开发者可以通过此 Hook 自定义页脚内容,例如添加版权信息或国际化文本。
关键要点
- admin_footer_text 是一个过滤器,参数为 $textstring,表示要打印的内容。
- 源代码使用 apply_filters( 'admin_footer_text', '' . $text . '' ) 来应用此过滤器。
- 此过滤器从 WordPress 2.8.0 版本引入。
- 可以通过 add_filter 函数添加自定义函数来修改页脚文本。
代码示例
function wpdocs_custom_admin_footer_text() {
return 'My footer custom text';
}
add_filter( 'admin_footer_text', 'wpdocs_custom_admin_footer_text' );注意事项
- 返回的文本可以进行国际化处理,例如使用 __( 'Custom footer text', 'text-domain' )。
原文内容
Filters the “Thank you” text displayed in the admin footer.
Parameters
$textstring-
The content that will be printed.
Source
echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . $text . '</span>' );
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |
Skip to note 2 content
Sajjad Hussain
This example displays a simple text on your admin area at the bottom:
function wpdocs_custom_admin_footer_text() { return 'My footer custom text'; } add_filter( 'admin_footer_text', 'wpdocs_custom_admin_footer_text' );Edited by @audrasjb – 2021/11/20
return __( ‘Custom footer text’, ‘text-domain’ );