Last active
January 23, 2018 02:28
-
-
Save tillkruss/b2cb59f601d7144e3497 to your computer and use it in GitHub Desktop.
Prevent `api.wordpress.org` requests timeouts: "Warning: 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.)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// increase `timeout` for `api.wordpress.org` requests | |
add_filter( 'http_request_args', function( $request, $url ) { | |
if ( strpos( $url, '://api.wordpress.org/' ) !== false ) { | |
$request[ 'timeout' ] = 15; | |
} | |
return $request; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment