WP_Http_Encoding::compress() WordPress Method

The WP_Http_Encoding::compress() method is used to compress data before sending it over the HTTP wire. This is useful for increasing performance by reducing the amount of data that needs to be sent.

WP_Http_Encoding::compress( string $raw, int $level = 9, string $supports = null ) #

Compress raw string using the deflate format.


Description

Supports the RFC 1951 standard.


Top ↑

Parameters

$raw

(string)(Required)String to compress.

$level

(int)(Optional) Compression level, 9 is highest.

Default value: 9

$supports

(string)(Optional) not used. When implemented it will choose the right compression based on what the server supports.

Default value: null


Top ↑

Return

(string|false) Compressed string on success, false on failure.


Top ↑

Source

File: wp-includes/class-wp-http-encoding.php

	public static function compress( $raw, $level = 9, $supports = null ) {
		return gzdeflate( $raw, $level );
	}

Top ↑

Changelog

Changelog
VersionDescription
2.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.