How to stop showing admin notice after close button has been clicked
First of all I do know how to add admin notice in the wordpress admin menu. And I added an admin notice like this:
?php
add_action( 'admin_notices', function() {
?
div class="notice notice-success is-dismissible"
p?php _e( 'Imagine something here!', 'sample-text-domain' ); ?/p
/div
?php
});
Now my code is running fine and smooth, just with one problem.
You see right now this notice starts showing up as soon as the user activates the plugin. and it stays up top until the user click on the close button.
Now when the user click on any other admin page the notice starts showing up again.
What I want:
I want this notice to show up for all those are installing the plugin for the first time or updated to the latest version of my plugin.
But once the user clicks on the close button, it will not show up ever again, no matter which page the user goes.
I did google search about it but didn't find any helpful answer, I hope you guys can help me out here.