Title: WP_Http_Encoding::should_decode
Published: April 25, 2014
Last modified: August 20, 2026

---

# WP_Http_Encoding::should_decode( array|string $headers ): bool

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#changelog)

Whether the content be decoded based on the headers.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#parameters)󠁿

 `$headers`array|stringrequired

All of the available headers.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#return)󠁿

 bool

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#source)󠁿

    ```php
    public static function should_decode( $headers ) {
    	if ( is_array( $headers ) ) {
    		if ( array_key_exists( 'content-encoding', $headers ) && ! empty( $headers['content-encoding'] ) ) {
    			return true;
    		}
    	} elseif ( is_string( $headers ) ) {
    		return ( stripos( $headers, 'content-encoding:' ) !== false );
    	}

    	return false;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-http-encoding.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-http-encoding.php#L208)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-http-encoding.php#L208-L218)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#related)󠁿

| Uses | Description | 
| [stripos()](https://developer.wordpress.org/reference/functions/stripos/)`wp-includes/class-pop3.php` |  |

| Used by | Description | 
| [WP_Http_Curl::request()](https://developer.wordpress.org/reference/classes/wp_http_curl/request/)`wp-includes/class-wp-http-curl.php` |

Send a HTTP request to a URI using cURL extension.

  | 
| [WP_Http_Streams::request()](https://developer.wordpress.org/reference/classes/wp_http_streams/request/)`wp-includes/class-wp-http-streams.php` |

Send a HTTP request to a URI using PHP Streams.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_http_encoding/should_decode/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_http_encoding%2Fshould_decode%2F)
before being able to contribute a note or feedback.