Custom Admin Dashboard Notice
Displays a custom information notice on the Dashboard page for editors so they see a welcome message on login.
PHPby SnipCraft
php
<?php
if ( ! function_exists( 'scseed_custom_dashboard_notice' ) ) {
function scseed_custom_dashboard_notice() {
$screen = get_current_screen();
if ( ! $screen || 'dashboard' !== $screen->id ) {
return;
}
// Show only to editors, not super-admins.
if ( ! current_user_can( 'edit_posts' ) || current_user_can( 'manage_options' ) ) {
return;
}
// Customize this message for your client or team.
$message = sprintf(
/* translators: %s: admin email */
__( 'Welcome! Need help? Contact your site administrator at %s.', 'scseed' ),
esc_html( get_option( 'admin_email' ) )
);
printf(
'<div class="notice notice-info is-dismissible"><p>%s</p></div>',
wp_kses_post( $message )
);
}
}
add_action( 'admin_notices', 'scseed_custom_dashboard_notice' );#admin#dashboard#editors#notices#onboarding