wp_admin_notice( string $message, array $args = array() )

Outputs an admin notice.


Parameters

$message string Required
The message to output.
$args array Optional
An array of arguments for the admin notice.
  • type string
    Optional. The type of admin notice.
    For example, 'error', 'success', 'warning', 'info'.
    Default empty string.
  • dismissible bool
    Optional. Whether the admin notice is dismissible. Default false.
  • id string
    Optional. The value of the admin notice's ID attribute. Default empty string.
  • additional_classes string[]
    Optional. A string array of class names.
  • paragraph_wrap bool
    Optional. Whether to wrap the message in paragraph tags. Default true.

Default: array()


Top ↑

Source

File: wp-includes/functions.php. View all references

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 ) );
}

Top ↑

Hooks



Top ↑

Changelog

Changelog
Version Description
6.4.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.