wp_remote_head

Retrieve the raw response from the HTTP request using the HEAD method.

Description

(WP_Error|array) wp_remote_head( (string) $url, (array) $args = array() ); 

Returns (WP_Error|array)

The response or WP_Error on failure.

Parameters (2)

0. $url (string)
Site URL to retrieve.
1. $args — Optional. (array) => array()
Request arguments. Default empty array.

Usage

  1. if ( !function_exists( 'wp_remote_head' ) ) { 
  2. require_once ABSPATH . WPINC . '/http.php'; 
  3.  
  4. // Site URL to retrieve. 
  5. $url = ''; 
  6.  
  7. // Optional. Request arguments. Default empty array. 
  8. $args = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wp_remote_head($url, $args); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/http.php  
  1. function wp_remote_head($url, $args = array()) { 
  2. $http = _wp_http_get_object(); 
  3. return $http->head( $url, $args );