You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
__( 'url: %1$s Status code 200 expected but was %2$s.', 'advanced-responsive-video-embedder' ),
133
139
$url,
134
140
$response_code
135
-
)
141
+
),
142
+
compact( 'url', 'response_code', 'response' )
136
143
);
137
144
}
138
145
@@ -166,6 +173,8 @@ function remote_get_head_cached( string $url, array $args = array(), int $time =
166
173
/**
167
174
* Retrieves the body content from a remote URL, with caching for improved performance.
168
175
*
176
+
* TODO maybe use json to encode WP_Error to avoid WP using serialize
177
+
*
169
178
* @param string $url The URL of the remote resource.
170
179
* @param array $args Optional. Additional arguments to include in the request.
171
180
* @param int $time Optional. The duration in seconds to cache the response. Default is DAY_IN_SECONDS. 0 to disable caching.
@@ -192,10 +201,26 @@ function _remote_get_cached( string $url, array $args, int $time, string $type )
192
201
if ( $time ) {
193
202
194
203
if ( is_wp_error( $response ) ) {
195
-
$response->add(
196
-
$response->get_error_code(),
197
-
'This error is cached for ' . $time . ' seconds. If you delete the transient ' . $transient_name . ' the call will be made again.'
204
+
205
+
$code = $response->get_error_code();
206
+
$msg = $response->get_error_message();
207
+
$data = $response->get_error_data( $code );
208
+
209
+
$response->remove( $code );
210
+
211
+
$msg .= '<br>' . sprintf(
212
+
wp_kses(
213
+
// Translators: 1 Time in seconds, 2 Transient name.
214
+
__( 'Error triggerd on %1$s and is cached for %2$d seconds. If you delete the transient <code>%3$s</code> the remote call will be made again.', 'advanced-responsive-video-embedder' ),
0 commit comments