$type, 'message' => $message, ), 10 * MINUTE_IN_SECONDS ); } /** * Take the message, if there is one. * * @param int $user_id WordPress user id. */ public static function pop( int $user_id ): ?array { $notice = get_transient( self::key( $user_id ) ); if ( ! is_array( $notice ) ) { return null; } delete_transient( self::key( $user_id ) ); return $notice; } }