求助:WordPress站点wp_remote_get()调用失败,排查后仍未解决
Hey there, let's walk through this step by step since you're new to WordPress and Avada—we'll get to the bottom of this! The error you're seeing means WordPress can't reach the Envato API endpoint, even after your admin added it to exceptions. Here's what you can check next:
First, run a direct test of wp_remote_get() in your WordPress admin
Sometimes the generic error message doesn't tell the whole story, so let's get specific details. You can use a code snippet (either via a plugin like Code Snippets, or temporarily add this to your child theme'sfunctions.phpfile—just remember to remove it after testing):add_action('admin_notices', 'test_envato_api_connection'); function test_envato_api_connection() { $api_url = 'https://build.envato.com/api/'; $response = wp_remote_get($api_url); if (is_wp_error($response)) { echo '<div class="notice notice-error"><p>Envato API Test Failed: ' . esc_html($response->get_error_message()) . '</p></div>'; // Log the error for deeper inspection error_log('Envato API Error: ' . $response->get_error_message()); } else { $status_code = wp_remote_retrieve_response_code($response); echo '<div class="notice notice-success"><p>Envato API Connected! Status Code: ' . $status_code . '</p></div>'; } }This will show a clear, actionable error in your WordPress admin (like timeout, SSL issue, or forbidden access) that tells you exactly what's blocking the request.
Ask your server admin to check for hidden restrictions
Even if they added the endpoint to exceptions, there might be other layers blocking it:- PHP settings: Confirm that
allow_url_fopenis enabled and thecurlextension is installed on your server (these are required forwp_remote_get()to work). They can check this viaphpinfo()or server config files. - WAF/Cloudflare: If your site uses a Web Application Firewall or Cloudflare, the rule might still be blocking the request even after the exception. Ask them to double-check firewall logs for any hits on the Envato API URL.
- DNS resolution: Have them run
ping build.envato.comornslookup build.envato.comon the server to make sure the domain resolves correctly—sometimes DNS issues can cause failed connections.
- PHP settings: Confirm that
Test the connection directly from the server command line
Ask your admin to run this curl command on the server:curl -v https://build.envato.com/api/The verbose output will show exactly where the connection fails—whether it's an SSL handshake issue, a timeout, or a server-side block. This helps rule out WordPress-specific issues and confirms if the server itself can reach the API.
Clear all caches
Sometimes cached settings can interfere with new exceptions. Clear Avada's built-in cache (under Avada > Theme Options > Performance), any WordPress caching plugins you're using, and even server-level caches like Redis or Varnish if applicable.
Once you have the specific error from the test snippet or curl command, you'll know exactly what to fix. For example, if it's an SSL error, your server might need updated SSL certificates; if it's a timeout, the server might have network restrictions preventing outbound requests to that domain.
内容的提问来源于stack exchange,提问作者bthrom

