钩子文档

personal_options

💡 云策文档标注

概述

personal_options 是一个 WordPress 动作钩子,在用户编辑屏幕的“个人选项”设置表末尾触发,用于扩展用户个人资料页面的功能。

关键要点

  • 触发时机:在用户编辑屏幕的“个人选项”设置表末尾,紧接“显示工具栏…”选项之后(如果当前用户)。
  • 参数:$profile_user(WP_User 对象),代表当前正在编辑的用户。
  • 输出注意事项:任何 HTML 输出应考虑到此钩子位于“Personal Options”元素内,需确保样式和布局兼容。
  • 源调用:do_action( 'personal_options', $profile_user );
  • 版本历史:自 WordPress 2.7.0 版本引入。

📄 原文内容

Fires at the end of the ‘Personal Options’ settings table on the user editing screen.

Parameters

$profile_userWP_User
The current WP_User object.

More Information

Hooks immediately after the “Show toolbar…” option on profile page (if current user). Any HTML output should take into account that this hook occurs within the “Personal Options” <table> element.

Source

do_action( 'personal_options', $profile_user );

Changelog

Version Description
2.7.0 Introduced.