PHP code example of juvo / wp-admin-notices

1. Go to this page and download the library: Download juvo/wp-admin-notices library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

juvo / wp-admin-notices example snippets


// Display stored notices
add_action( 'admin_init', function() {
   $notices = new \juvo\WordPressAdminNotices\Manager();
   $notices->notices();
} );

// Add a notice.
\juvo\WordPressAdminNotices\Manager::add((string) $id, (string) $title, (string) $content, (array) $options);

// Remove a notice.
\juvo\WordPressAdminNotices\Manager::remove((string) $id, (bool) $onlyGlobal);

//Example: Check if Advanced Custom Fields Pro is installed
if ( ! class_exists( 'acf_pro' ) ) {
   // Add a notice.
   Manager::add( "missing_plugin", "Required plugin missing","The advanced custom fields plugin is