Skip to content

Installation

Requirements

  • PHP 7.4+
  • WordPress 6.0+
  • Composer

Composer

console
composer require duckdev/wp-review-notice

Classes autoload under the DuckDev\Reviews\ namespace via PSR-4.

Bootstrapping

Register on plugins_loaded. register() is what hooks admin_notices + admin_init and seeds the show-time schedule. Calling create() without register() does nothing — useful for tests, or for configuring a notice you want to render manually.

php
add_action( 'plugins_loaded', function () {
    \DuckDev\Reviews\Notice::create(
        'my-plugin', // wp.org plugin slug (e.g. "hello-dolly").
        'My Plugin', // Display name shown in the notice copy.
        array(
            'days'    => 7,
            'cap'     => 'manage_options',
            'screens' => array( 'dashboard', 'plugins' ),
        )
    )->register();
} );

Options

KeyTypeDefaultDescription
daysint7Days to wait before showing the notice for the first time.
screensarray[]Allowed admin screen IDs. Empty = every admin screen.
capstringmanage_optionsCapability required to see and act on the notice.
classesarray[]Extra CSS classes appended to the notice notice-info wrapper.
domainstringduckdevText domain used for the bundled copy.
messagestringauto-generatedCustom HTML message. Not escaped — sanitise it yourself.
action_labelsarraybundled labelsKeys: review, later, dismiss. Set any to '' to hide that link.
prefixstringslug with -_Storage namespace. Keys are written as {prefix}_review_{key}.