Created
June 15, 2020 23:51
-
-
Save utkrishta/8c4f40f89b97b62dbd26612bb078b1cc to your computer and use it in GitHub Desktop.
Custom Notification in WP Admin
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 | |
//add custom notification in WP Admin | |
function general_admin_notice(){ | |
global $pagenow; | |
if ( $pagenow == 'post.php' ) { // add/edit pages/files as required | |
//add any custom message here | |
$current_user = wp_get_current_user(); | |
$user_name = $current_user->user_firstname; | |
echo '<div class="notice notice-warning"> | |
<p>Hey <strong>'. $user_name . '.</strong> You are awesome!</p> | |
</div>'; | |
} | |
} | |
add_action('admin_notices', 'general_admin_notice'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment