wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_remote_retrieve_response_code › WordPress Function

Seit2.7.0
Veraltetn/v
wp_remote_retrieve_response_code ( $response )
Parameter:
  • (array|WP_Error) $response HTTP response.
    Erforderlich: Ja
Gibt zurück:
  • (int|string) The response code as an integer. Empty string if incorrect parameter given.
Definiert in:
Codex:

Retrieve only the response code from the raw response.

Will return an empty string if incorrect parameter value is given.


Quellcode

function wp_remote_retrieve_response_code( $response ) {
	if ( is_wp_error( $response ) || ! isset( $response['response'] ) || ! is_array( $response['response'] ) ) {
		return '';
	}

	return $response['response']['code'];
}