wp_strip_all_tags($message), 'type' => $type, ], 2 * MINUTE_IN_SECONDS ); } public static function pull(): ?array { $userId = get_current_user_id(); if ($userId <= 0) return null; $key = self::TRANSIENT_PREFIX . $userId; $notice = get_transient($key); if ($notice === false) return null; delete_transient($key); if (!is_array($notice) || empty($notice['message'])) return null; $type = isset($notice['type']) && in_array($notice['type'], self::ALLOWED_TYPES, true) ? $notice['type'] : 'info'; return [ 'message' => (string) $notice['message'], 'type' => $type, ]; } }