Skip to content

Instantly share code, notes, and snippets.

@xxsimoxx
Created October 6, 2021 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xxsimoxx/5e35e9a7af09385f1db6805c293eb960 to your computer and use it in GitHub Desktop.
Save xxsimoxx/5e35e9a7af09385f1db6805c293eb960 to your computer and use it in GitHub Desktop.
Fix (the worst way) troubles with untrusted certificates in ClassicPress.
<?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