WordPress 4.2 introduced a feature where admin notices can now be dismissed / removed from the admin page currently being viewed. One caveat I discovered was, the dismissal do not persist across pages. That is, when you reload or navigate away from the current admin page to another, you will still see the notice. I wrote a small library / plugin that elegantly solves this problem which i will be sharing to us. You can easily reuse it in your themes and plugins. And it is also pretty well documented. Here is a link to the library on GitHub How to Use it Firstly, install and activate it by cloning / downloading to your WordPress wp-content/plugins directory. Say you have the following markup as your admin notice 12345678 functionsample_admin_notice__success(){?><div class="updated notice notice-success is-dismissible"><p><?php_e('Done!','sample-text-domain');?></p></div><?php}add_action('admin_notices','sample_admin_notice__success'); To make it hidden forever when dismissed, add the following data attribute data-dismissible="disable-done-notice-forever" to the div markup like so: 12345678 functionsample_admin_notice__success(){?><div
Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.