wp_editor_set_quality filter-hookWP 3.5.0

Filters the default image compression quality setting.

Applies only during initial editor instantiation, or when set_quality() is run manually without the $quality argument.

The WP_Image_Editor::set_quality() method has priority over the filter.

Usage

add_filter( 'wp_editor_set_quality', 'wp_kama_editor_set_quality_filter', 10, 2 );

/**
 * Function for `wp_editor_set_quality` filter-hook.
 * 
 * @param int    $quality   Quality level between 1 (low) and 100 (high).
 * @param string $mime_type Image mime type.
 *
 * @return int
 */
function wp_kama_editor_set_quality_filter( $quality, $mime_type ){

	// filter...
	return $quality;
}
$quality(int)
Quality level between 1 (low) and 100 (high).
$mime_type(string)
Image mime type.

Changelog

Since 3.5.0 Introduced.

Where the hook is called

WP_Image_Editor::set_quality()
wp_editor_set_quality
wp-includes/class-wp-image-editor.php 249
$quality = apply_filters( 'wp_editor_set_quality', $default_quality, $mime_type );

Where the hook is used in WordPress

Usage not found.