钩子文档

network_admin_menu

💡 云策文档标注

概述

network_admin_menu 是一个 WordPress 动作钩子,在 Network Admin 的管理菜单加载前触发,用于向多站点安装中的超级管理员添加额外的子菜单和菜单选项。

关键要点

  • network_admin_menu 钩子在 Network Admin 的基本菜单结构就绪后执行,允许开发者扩展菜单。
  • 此钩子仅适用于多站点安装,且仅对超级管理员可见,用于自定义网络管理面板。
  • 典型用法包括在关联函数中调用 add_submenu_page() 来添加子菜单页面。

代码示例

do_action( 'network_admin_menu', '' );

注意事项

  • 参数 $context 为空字符串,表示没有上下文信息传递。
  • 此钩子自 WordPress 3.1.0 版本引入,使用时需确保版本兼容性。

📄 原文内容

Fires before the administration menu loads in the Network Admin.

Parameters

$contextstring
Empty context.

More Information

This action is used to add extra submenus and menu options to the network admin panel’s menu structure. The network admin panel is only seen by a super admin in a multisite installation.

The function associated with this action runs after the basic network admin panel menu structure is in place. For example, the function might call add_submenu_page() to add a submenu page.

Source

do_action( 'network_admin_menu', '' );

Changelog

Version Description
3.1.0 Introduced.