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

Outputs an admin notice.


The message to output.
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.
  • attributes string[]
    Optional. Additional attributes for the notice div.
  • paragraph_wrap bool
    Optional. Whether to wrap the message in paragraph tags. Default true.



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


do_action( ‘wp_admin_notice’, string $message, array $args )

Fires before an admin notice is output.



User Contributed Notes

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