admin-notice icon indicating copy to clipboard operation
admin-notice copied to clipboard

Add support for "nag" notices

Open stevegrunwell opened this issue 3 years ago • 0 comments

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();

stevegrunwell avatar Apr 21 '22 15:04 stevegrunwell