Are you getting an error message that says “Unable to establish secure connection” in WordPress? It’s a typical WordPress problem that happens when you try to install or update a plugin or theme from the official WordPress.org directory. We’ll show you why this error happens and how to simply fix secure connection error in WordPress in this article.
Why Does WordPress Fail to Establish Secure Connection?
WordPress has an update management system built in. This system checks for updates on a regular basis and displays reminders for you to install plugin and theme updates.
However, in order to check for updates or install them, it must connect to the WordPress.org website. Your website may be unable to connect to the WordPress.org website due to a misconfiguration on your WordPress hosting server.
A secure connection error will occur, and you will see an error message similar to this:
|An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /home/username/public_html/wp-admin/includes/update.php on line 122|
So, let’s have a look at how to quickly fix a secure connection error in WordPress.
Fixing the WordPress Secure Connection Error
The unexpected secure connection error in WordPress can be fixed in a number of ways. Depending on your situation, you can attempt one of the following options.
Server and Hosting Issues
If your shared hosting server is under DDoS attack, the secure connection to WordPress.org may timeout.
After such case, try again in a few minutes. If the problem persists, contact your web hosting company’s support team.
Connectivity Issues with Cloud or VPS Servers
It’s conceivable that your server is unable to connect to WordPress.org owing to DNS difficulties if you’re using cloud or VPS hosting.
You can point your server directly to WordPress.org servers in that instance. You’ll need to use SSH to connect to your server.
Secure shell, or SSH, is an encrypted protocol that lets you access to your server using command-line tools.
Users on Windows can utilise PuTTy, while Mac and Linux users can use the terminal programme.
You’ll need login credentials for your hosting account’s account with shell access. You can find this information on your cPanel dashboard or by contacting your web hosting server provider.
ssh [email protected]
Replace username with your username and example.com with your domain name.
After connecting, run the following command:
sudo nano /etc/hosts
This will open a file where you must add the following code:
You can now save and quit the editor. Check your website to see if it worked.
Fixing the Secure Connection Error with WordPress on Localhost
If you’re operating WordPress on your own computer (localhost), the cURL extension for PHP might not be enabled. This addon is required in order to update WordPress.org.
You’ll need to make changes to your computer’s php.ini file. This file is normally found in your Mamp, Xampp, or WAMP folder’s PHP folder.
If you’re using a Windows computer, search for the line that says:
Users of Mac and Linux will need to look for the following line:
To activate the extension, remove the semicolon from the beginning of the text. Remember to save the php.ini file.
Finally, restart the Apache server for the changes to take effect.
Firewall Open Ports:
If your local server has the cURL extension installed, you should verify your internet connection firewall.
Your computer’s firewall may be preventing connections to WordPress.org. On Windows, click Start and search for Windows Firewall. Firewall options for Mac users are in
Security & Privacy » System Preferences
Allow both incoming and outgoing connections by adding Apache to your firewall’s authorized apps.
For the modifications to take effect, you must restart Apache.
We hope this post was helpful in resolving the secure connection error in WordPress. You might also be interested in our comprehensive WordPress security guide for beginners.