I’m using Vagrant to work on a WordPress site and noticed the following error throughout several admin pages that attempt to connect to WordPress.org:
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.)
Upon further investigation, since I knew there wasn’t an issue with WordPress.org, the response from WordPress’ wp_remote_post
call contained:
name lookup timed out
In my case, this was because the DNS server was unable to return a response in time (or at all).
A simple fix is to add api.wordpress.org
to your server’s host file.
If you use Puppet, you can do this via:
host { "api.wordpress.org": ip => "66.155.40.202", }
Or, if you just want to edit the host file manually (/etc/hosts
), you can add the following:
66.155.40.202 api.wordpress.org
Hope this helps someone else!
You sir, are a scholar and gentleman. Thank you for the quickfix!
Yep, helped me too. Thanks for the post.
Alas, while I’m in the exact same situation as you, adding it to the
/etc/hosts
file doesn’t appear to fix it 🙁 I’ve tried everything at this point.Temporarily
print_r
the result ofwp_remote_post
and then try to generate the notice again by going to one of the admin pages. What is it printing out?I had to increase the request timeout for
api.wordpress.org
requests: https://gist.github.com/tillkruess/b2cb59f601d7144e3497Good tip! Thanks for sharing it!
Copy of the Gist, in case it disappears:
Awesome trick, Thanks for sharing. @Till and @Ryan
Thank you for this. It’s still useful (and necessary!) three years on!
Solved my “WordPress could not establish a secure connection to WordPress.org” error. Thanks a lot!
yupp.. me too, thx
Thank you.
Finally an answer! Thank you mister!
Thanks a lot!
Thank you so much! My vagrant box has been spitting this message out randomly lately, until it was persistent this morning. This does appear to have resolved the issue.
It took me forever to find this post! Thanks for sharing, it solved all my issues (which I had been dealing with for almost a week). You’re awesome!!!
Awesome….thanks…problem solved
Awesome…Awesome…Awesome…
thanks!!!
Pingback: WordPress Error on Virtual Servers - Jacob McKinneyJacob McKinney
This solution helped me.
http://robert.penz.name/902/slow-dns-resolving-with-linux-systems-against-windows-dns-server/
It’s something wrong with DNS resolver.
Hi Edward, thanks for sharing this. Robert’s solution suggests adding
options single-request-reopen
to/etc/resolv.conf
.Pingback: Wordpress错误:could not establish a secure connection to WordPress.org – WBCHN 之家
Thank you
I thought it was something related to SSL or Curl in Php.
I added this line ( 66.155.40.202 api.wordpress.org ) to /etc/hosts on a Ubuntu 16.04 server and all worked.
After 4-5 hours finally got the solution. Thanks a lot
This is great! It works in my case
Pingback: WordPress Error on Virtual Servers - Jacob McKinney