Skip to content
wp-skills
Register
tools/admin-notice-generator

Admin Notice Generator

Admin Notice Generator is a tool for creating and editing admin notices in WordPress. This tool is used to display important messages and manage admin alerts on users WordPress site.

Give it a prefix of your own. Two snippets sharing a function name is a fatal redeclaration.

Your theme or plugin's own domain, for the message below.

Printed through esc_html(), so markup typed here is shown rather than rendered.

snippet.php
function my_custom_admin_notice() {
	$message     = __( 'Lorem ipsum dolor sit amet.', 'text-domain' );
	$type        = 'success';
	$dismissible = true;
	$classes     = 'notice notice-' . $type . ( $dismissible ? ' is-dismissible' : '' );

	printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $classes ), esc_html( $message ) );
}
add_action( 'admin_notices', 'my_custom_admin_notice' );