Created
January 15, 2019 12:49
-
-
Save grola/a71c7fab1370611eb1bb406842c676cc to your computer and use it in GitHub Desktop.
Conditional notice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpdesk_info_notice_for_administrator() { | |
$user = wp_get current_user(); | |
if ( in_array( 'administrator', $user->roles ) ) { | |
?> | |
<div class="notice notice-info"> | |
<p>Info notice for administrator.</p> | |
</div> | |
<?php | |
} | |
} | |
add_action( 'admin_notices', 'wpdesk_info_notice_for administrator' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment