REST API to self domain always timed out

Hi, whenever I want to call REST API within the same domain, I always get Curl timed out with this error:

object(WP_Error)[996]
  public 'errors' => 
    array (size=1)
      'http_request_failed' => 
        array (size=1)
          0 => string 'cURL error 28: Operation timed out after 5000 milliseconds with 0 bytes received' (length=80)
  public 'error_data' => 
    array (size=0)
      empty

In Apache server like WAMP and my live host, this works just fine

You can try this simple code:

$get = wp_remote_get('http://yoursite.test/wp-json/wp/v2/posts');

var_dump( $get );

I also tried a fresh installation on both Single & Multisite and got the same error. Cross-domain API works fine though

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.