WordPress 挂钩调用仪表板中除管理以外的函数

WordPress hook to call a function in dashboard other than admin

除管理员外,是否有任何 WordPress 挂钩可以在仪表板上调用。

我有这个钩子

add_action('admin_head','upgrade_notification_free_user');

它对管理员帐户工作正常,但当我从另一个帐户登录时它不会触发。

有什么建议吗?

根据 WordPress 代码参考,“admin_head”操作应在所有管理页面的头部部分触发。

或者,您可以尝试“admin_init' or 'in_admin_footer”,具体取决于您的函数要完成的任务。

尝试安装 Query Monitor plugin it will show you all hooks that are fired when a page is loaded. Make sure to use a special authentication cookie - see here 以获得详细信息 - 这样非管理员也能看到查询监视器的输出。