apply_filters( 'wp_editor_set_quality', int $quality, string $mime_type )
- Since
- 3.5.0
Filters the default image compression quality setting.
Description
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.
Compatibility
- WordPress
- since 3.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$qualityint- Quality level between 1 (low) and 100 (high).
$mime_typestring- Image mime type.
Where this hook fires · 1
wp-includes/class-wp-image-editor.php:267WP_Image_Editor::set_quality()
Source code
* * @since 3.5.0 * * @param int $quality Quality level between 1 (low) and 100 (high). * @param string $mime_type Image mime type. */ $quality = apply_filters( 'wp_editor_set_quality', $default_quality, $mime_type ); if ( 'image/jpeg' === $mime_type ) { /** * Filters the JPEG compression quality for backward-compatibility. * * Applies only during initial editor instantiation, or when set_quality() is runChangelog
Introduced in 3.5.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.8.8
Parameter
$size added.verified against source3.5.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.