Hook
Add Backend Admin Notifications
Sometimes we need to add notifications or else details to the backend admin areas of the WordPress Admin, for example perhaps we need to display a warning on the “All Posts” list page about certain image sizes that should be used, or anything alike.
Unfortunately since Gutenberg was forced on WordPress users, it is not possible anymore to add notifications to each Single Post Edit Screen, but it is still possible to add notifications to the “All Posts” list page.
The below action creates a div with a custom warning in it, using some background color and positioning to make it look better. It puts this warning into the “All Posts” Screen, although you can put it in any screen you want by altering the conditional part $screen->id !='edit-post'
add_action('admin_notices','tkt_post_admin_notice'); function tkt_post_admin_notice(){ //Get the Current Screen $screen = get_current_screen();//If not on the screen with ID 'edit-post' abort.
if( $screen->id !='edit-post' )
return;
?>
<style>
.tkt-alert {
padding: 20px;
background-color: #718c69;
color: white;
margin-right: 20px;
margin-top: 50px;
}
</style>
<div class="tkt-alert">
<p>
Use <strong>1200 pixel by 630 pixel</strong> image size minimally when uploading Featured Image.<br>
Use H2 tags for headings, and H3 for subheadings.br>
When adding numbered items make sure there is a space after the dot like so 1. Item Name
</p>
</div>
<?php
}