admin_color_scheme_picker
云策文档标注
概述
admin_color_scheme_picker 是一个 WordPress 动作钩子,在用户编辑屏幕的‘Administration Color Scheme’部分触发。该部分仅在至少有一个回调函数挂接到此动作,且管理员定义了多个颜色方案时启用。
关键要点
- 触发位置:用户编辑屏幕的‘Administration Color Scheme’部分。
- 启用条件:需要至少一个回调函数挂接到此动作,且管理员定义了多个颜色方案。
- 参数:$user_id(整数类型),表示用户 ID。
- 版本历史:3.0.0 版本引入,3.8.1 版本添加了 $user_id 参数。
代码示例
/**
* Remove the color picker from the user profile admin page.
*/
function wpdocs_remove_admin_color_scheme_picker() {
remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
}
add_action( 'admin_head-profile.php', 'wpdocs_remove_admin_color_scheme_picker' );
原文内容
Fires in the ‘Administration Color Scheme’ section of the user editing screen.
Description
The section is only enabled if a callback is hooked to the action, and if there is more than one defined color scheme for the admin.
Parameters
$user_idint-
The user ID.
Source
do_action( 'admin_color_scheme_picker', $user_id );
Skip to note 2 content
Andrea Alba
/** * Remove the color picker from the user profile admin page. */ function wpdocs_remove_admin_color_scheme_picker() { remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); } add_action( 'admin_head-profile.php', 'wpdocs_remove_admin_color_scheme_picker' );