wp_admin_notice( string $message, array $args = array() )
Outputs an admin notice.
Parameters
- $message
-
(Required) The message to output.
- $args
-
(Optional) An array of arguments for the admin notice. <br>
- 'type'
(string) Optional. The type of admin notice.<br> For example, 'error', 'success', 'warning', 'info'.<br> Default empty string.<br> - 'dismissible'
(bool) Optional. Whether the admin notice is dismissible. Default false.<br> - 'id'
(string) Optional. The value of the admin notice's ID attribute. Default empty string.<br> - 'additional_classes'
(string[]) Optional. A string array of class names. <br> - 'attributes'
(string[]) Optional. Additional attributes for the notice div. <br> - 'paragraph_wrap'
(bool) Optional. Whether to wrap the message in paragraph tags. Default true.<br>
Default value: array()
- 'type'
Source
File: wp-includes/functions.php
function wp_admin_notice( $message, $args = array() ) {
/**
* Fires before an admin notice is output.
*
* @since 6.4.0
*
* @param string $message The message for the admin notice.
* @param array $args The arguments for the admin notice.
*/
do_action( 'wp_admin_notice', $message, $args );
echo wp_kses_post( wp_get_admin_notice( $message, $args ) );
}
Changelog
Version | Description |
---|---|
6.4.0 | Introduced. |