钩子文档

wp_admin_notice

💡 云策文档标注

概述

wp_admin_notice 是一个 WordPress 钩子,在输出管理员通知前触发,允许开发者自定义通知消息和参数。

关键要点

  • 这是一个动作钩子,用于在管理员通知显示前执行自定义代码。
  • 钩子接收两个参数:$message(通知消息字符串)和 $args(通知参数数组)。
  • 通过 do_action('wp_admin_notice', $message, $args) 调用,与 wp_admin_notice() 函数相关。
  • 自 WordPress 6.4.0 版本引入。

📄 原文内容

Fires before an admin notice is output.

Parameters

$messagestring
The message for the admin notice.
$argsarray
The arguments for the admin notice.

Source

do_action( 'wp_admin_notice', $message, $args );

Changelog

Version Description
6.4.0 Introduced.