I use Vagrant as my environment for most of my development. The other day I was working on one of my installs when I received the following WordPress error throughout most of my admin:
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.)After a ton of time sifting through forums and speaking to other developers, I finally ran down the source of my problem (thanks Ryan Sechrest), my DNS server was timing out while trying to connect to WordPress.org
The simplest fix for this is to add the following to your server's host file:
This essentially provides a more direct connection to WordPress.org, which avoids any timeout issues.
If you don't know how to edit Vagrant's hosts file manually (I didn't the first time I did this), follow these steps:
- Just open up the console and navigate to your Vagrant file.
- Ssh into Vagrant using
- Navigate to the
- Open the hosts file using Nano
sudo nano hosts
126.96.36.199 api.wordpress.orgto the file and save.
Voilà! All your WordPress installs should now connect to WordPress.org quickly and without any errors.
Hope this helps someone else!
You can check out Ryan's original post about the same issue here.