%1$s', $message, $classes); } } function pcm_cache_wpp_cookies_pages_admin_notice() { $cache_wpp_cookies_pages_activate_display_notice = get_option('cache_wpp_cookies_pages_activate_notice', 'activating'); if ('activating' === $cache_wpp_cookies_pages_activate_display_notice && current_user_can('manage_options')) { add_action('admin_notices', function () { $screen = get_current_screen(); //Display admin notice for this plugin page only if ($screen->id !== 'toplevel_page_pressable_cache_management') return; $user = $GLOBALS['current_user']; $message = sprintf('

Batcache will now cache pages with wpp_ cookies.

'); cache_wpp_cookies_pages_admin_notice($message, 'notice notice-success is-dismissible'); }); update_option('cache_wpp_cookies_pages_activate_notice', 'activated'); } } add_action('init', 'pcm_cache_wpp_cookies_pages_admin_notice'); } else { /**Update option from the database if the option is deactivated used by admin notice to display and remove notice**/ update_option('cache_wpp_cookies_pages_activate_notice', 'activating'); $obj_cache_wpp_cookies_pages = WP_CONTENT_DIR . '/mu-plugins/pressable-cache-management/pcm_cache_wpp_cookies_pages.php'; if (file_exists($obj_cache_wpp_cookies_pages)) { unlink($obj_cache_wpp_cookies_pages); //Flush cache to enable deactivation take effect immediately wp_cache_flush(); } else { // File not found. } }