get_status_header_desc

Retrieve the description for the HTTP status.

Description

(string) get_status_header_desc( (int) $code ); 

Returns (string)

Empty string if not found, or description if found.

Parameters (1)

0. $code (int)
HTTP status code.

Usage

  1. if ( !function_exists( 'get_status_header_desc' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // HTTP status code. 
  5. $code = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_status_header_desc($code); 
  9.  

Defined (1)

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

/wp-includes/functions.php  
  1. function get_status_header_desc( $code ) { 
  2. global $wp_header_to_desc; 
  3.  
  4. $code = absint( $code ); 
  5.  
  6. if ( !isset( $wp_header_to_desc ) ) { 
  7. $wp_header_to_desc = array( 
  8. 100 => 'Continue',  
  9. 101 => 'Switching Protocols',  
  10. 102 => 'Processing',  
  11.  
  12. 200 => 'OK',  
  13. 201 => 'Created',  
  14. 202 => 'Accepted',  
  15. 203 => 'Non-Authoritative Information',  
  16. 204 => 'No Content',  
  17. 205 => 'Reset Content',  
  18. 206 => 'Partial Content',  
  19. 207 => 'Multi-Status',  
  20. 226 => 'IM Used',  
  21.  
  22. 300 => 'Multiple Choices',  
  23. 301 => 'Moved Permanently',  
  24. 302 => 'Found',  
  25. 303 => 'See Other',  
  26. 304 => 'Not Modified',  
  27. 305 => 'Use Proxy',  
  28. 306 => 'Reserved',  
  29. 307 => 'Temporary Redirect',  
  30. 308 => 'Permanent Redirect',  
  31.  
  32. 400 => 'Bad Request',  
  33. 401 => 'Unauthorized',  
  34. 402 => 'Payment Required',  
  35. 403 => 'Forbidden',  
  36. 404 => 'Not Found',  
  37. 405 => 'Method Not Allowed',  
  38. 406 => 'Not Acceptable',  
  39. 407 => 'Proxy Authentication Required',  
  40. 408 => 'Request Timeout',  
  41. 409 => 'Conflict',  
  42. 410 => 'Gone',  
  43. 411 => 'Length Required',  
  44. 412 => 'Precondition Failed',  
  45. 413 => 'Request Entity Too Large',  
  46. 414 => 'Request-URI Too Long',  
  47. 415 => 'Unsupported Media Type',  
  48. 416 => 'Requested Range Not Satisfiable',  
  49. 417 => 'Expectation Failed',  
  50. 418 => 'I\'m a teapot',  
  51. 421 => 'Misdirected Request',  
  52. 422 => 'Unprocessable Entity',  
  53. 423 => 'Locked',  
  54. 424 => 'Failed Dependency',  
  55. 426 => 'Upgrade Required',  
  56. 428 => 'Precondition Required',  
  57. 429 => 'Too Many Requests',  
  58. 431 => 'Request Header Fields Too Large',  
  59. 451 => 'Unavailable For Legal Reasons',  
  60.  
  61. 500 => 'Internal Server Error',  
  62. 501 => 'Not Implemented',  
  63. 502 => 'Bad Gateway',  
  64. 503 => 'Service Unavailable',  
  65. 504 => 'Gateway Timeout',  
  66. 505 => 'HTTP Version Not Supported',  
  67. 506 => 'Variant Also Negotiates',  
  68. 507 => 'Insufficient Storage',  
  69. 510 => 'Not Extended',  
  70. 511 => 'Network Authentication Required',  
  71. ); 
  72.  
  73. if ( isset( $wp_header_to_desc[$code] ) ) 
  74. return $wp_header_to_desc[$code]; 
  75. else 
  76. return '';