PHP code example of wpscholar / wp-transient-admin-notices
1. Go to this page and download the library: Download wpscholar/wp-transient-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/ */
wpscholar / wp-transient-admin-notices example snippets
use wpscholar\WordPress\TransientAdminNotices;
add_action( 'admin_init', function() {
$transient_name = md5( 'my_plugin' . get_current_user_id() );
$notices = new TransientAdminNotices( $transient_name );
if( ! $user_has_account ) {
$notices->add( 'msg1', 'Looks like you have not created an account yet!', 'warning' );
}
} );