[...], 'feed' => [...] ). */ public static function get_remote_data( $force_update = false ) { $cache_key = self::TRANSIENT_KEY; $info_data = get_transient( $cache_key ); if ( $force_update || false === $info_data ) { $timeout = ( $force_update ) ? 25 : 8; $response = wp_remote_get( sprintf( '%s/%s', self::REMOTE_BASE_URL, self::ENDPOINT_FILE ), [ 'timeout' => $timeout, ] ); if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) { set_transient( $cache_key, [], HOUR_IN_SECONDS ); return []; } $info_data = json_decode( wp_remote_retrieve_body( $response ), true ); if ( empty( $info_data ) || ! is_array( $info_data ) ) { set_transient( $cache_key, [], HOUR_IN_SECONDS ); return []; } set_transient( $cache_key, $info_data, 12 * HOUR_IN_SECONDS ); } return empty( $info_data ) ? [] : $info_data; } }