mirror of
https://gh.wpcy.net/https://github.com/szepeviktor/wordpress-website-lifecycle.git
synced 2026-04-24 05:09:10 +08:00
21 lines
515 B
PHP
21 lines
515 B
PHP
<?php
|
|
|
|
/*
|
|
* Plugin Name: Log Disqus API errors
|
|
* Plugin URI: https://github.com/szepeviktor/wordpress-website-lifecycle
|
|
*/
|
|
|
|
add_filter(
|
|
'http_response',
|
|
static function ($response, $parsedArgs, $url) {
|
|
if (
|
|
strpos($url, 'https://disqus.com/api/') === 0
|
|
&& wp_remote_retrieve_response_code($response) !== 200
|
|
) {
|
|
error_log(sprintf('Disqus API error: %s', wp_remote_retrieve_body($response)));
|
|
}
|
|
return $response;
|
|
},
|
|
10,
|
|
3
|
|
);
|