How to fix SSL problem with wp plugin on localhost

482 Likes Comment

If you’re on the way to POC new features of your website on localhost, of course the website base on wordpress . I bet that you’ll meet this error for sure: Failure: cURL error 60: SSL certificate problem: self signed certificate in cert

How to deal with this error. Just create a folder named “mu-plugins” under the wp-content/ folder. Then create a file named “disable-ssl-verification.php” with the following code:

<?php

/**
 * Plugin Name: Disable SSL Verification
 * Description: WordPress themes and plugin can't be updated when using a self-signed SSL certificate. This plugin disables SSL verification if the WordPress site is loaded using a <code>.test</code> domain.
 * Version: 1.0.0
 * Author: Ryan Sechrest
 */

if (!isset($_SERVER['SERVER_NAME'])) {
    return;
}
if (!str_ends_with($_SERVER['SERVER_NAME'], '.test')) {
    return;
}
add_filter('https_ssl_verify', '__return_false');

Save and enjoy.

You might like

Avatar

About the Author: Toc Xoan

Leave a Reply

Your email address will not be published. Required fields are marked *