admin-notice
admin-notice copied to clipboard
Add support for "nag" notices
There's a semi-official convention for handling "nag" notices (e.g. upsells, "Don't forget to rate the plugin", etc.) within WP Admin: the DISABLE_NAG_NOTICES constant.
When this constant is true, non-essential notices should be hidden (though it's entirely up to plugin authors to respect the user's choice).
It would be nice if the AdminNotice class exposed a method (perhaps with a better term than "nag"?) for marking these notices and automatically not rendering them if DISABLE_NAG_NOTICES is set, e.g.:
use StellarWP\AdminNotice\AdminNotice;
AdminNotice::factory("Don't forget to leave us a review on WordPress.org!")
->setPromotional(true)
->queue();