Skip to content

Instantly share code, notes, and snippets.

@xxsimoxx
Created Oct 6, 2021
Embed
What would you like to do?
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