钩子文档

_user_admin_menu

💡 云策文档标注

概述

_user_admin_menu 是一个 WordPress 动作钩子,在用户管理后台菜单加载前触发,允许开发者在菜单基于用户权限被移除前进行修改。

关键要点

  • 触发时机:在用户管理后台菜单加载前,菜单和子菜单基于用户权限被移除之前。
  • 主要用途:可用于修改用户管理面板的菜单结构,例如添加或移除菜单项。
  • 替代方案:通常更推荐使用 admin_menu 动作钩子,它在菜单完全构建后触发,更适合大多数菜单修改场景。
  • 技术细节:通过 do_action( '_user_admin_menu' ) 调用,自 WordPress 3.1.0 版本引入。

📄 原文内容

Fires before the administration menu loads in the User Admin.

Description

The hook fires before menus and sub-menus are removed based on user privileges.

More Information

This action could be used to modify the menu in the user admin panel. It runs before the basic user admin panel menu structure is complete. It is more usual to use the admin_menu action to modify the menu after it is complete.

Source

do_action( '_user_admin_menu' );

Changelog

Version Description
3.1.0 Introduced.