Created
October 6, 2021 14:49
-
-
Save xxsimoxx/5e35e9a7af09385f1db6805c293eb960 to your computer and use it in GitHub Desktop.
Fix (the worst way) troubles with untrusted certificates in ClassicPress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: twk | |
* | |
* Description: Fix (the worst way) troubles with untrusted certificates in ClassicPress. | |
* | |
*/ | |
if (!defined('ABSPATH')){ | |
die('-1'); | |
}; | |
add_filter('http_request_args', 'xsx_fix_ssl_issues', 10, 2 ); | |
function xsx_fix_ssl_issues($r, $url) { | |
// Array of regex of sources to fix. | |
$fix_domains = [ | |
'/^https?:\/\/api-v1\.classicpress\.net/', | |
'/^https?:\/\/software.gieffeedizioni.it/', | |
]; | |
foreach ($fix_domains as $fix_domain) { | |
if(preg_match($fix_domain, $url) === 1) { | |
$r['sslverify'] = false; | |
return $r; | |
} | |
} | |
return $r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment