{$message}

"; delete_option(self::AFPW_NOTICE_FIELD); } } public function displayError($message) { $this->updateOption($message, 'notice-error'); } public function displayWarning($message) { $this->updateOption($message, 'notice-warning'); } public function displayInfo($message) { $this->updateOption($message, 'notice-info'); } public function displaySuccess($message) { $this->updateOption($message, 'notice-success'); } protected function updateOption($message, $noticeLevel) { update_option(self::AFPW_NOTICE_FIELD, [ 'message' => $message, 'notice-level' => $noticeLevel ]); } } // Usage: // ====== // $notice = AFPWAdminNotice::getInstance(); // $notice->displayError(__('Better flee, an error occurred.', 'herp')); // add_action('admin_notices', [AFPWAdminNotice::getInstance(), 'displayAdminNotice']);