• Resolved Diiamo

    (@luislu)


    Hi,I want to set webp quality, Is below filter right?

    apply_filters( ‘wp_editor_set_quality’, 90, image/webp );

    Is the default quality 86?

    Thanks in advance.

    • This topic was modified 1 year, 8 months ago by Diiamo.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Hi @luislu,

    Thanks for reaching out. You can use the filter as below:

    function set_webp_quality( $quality, $mime_type ) {
    if ( 'image/webp' === $mime_type ) {
    return 90;
    }
    return $quality;
    }
    add_filter( 'wp_editor_set_quality', 'set_webp_quality', 10, 2 );


    With regards your default quality query this is set as 82. You’ll find more details on this below:
    https://github.com/WordPress/performance/issues/563

    One other thing to note is that if you have your WebP image quality set very high, and the WebP file size is greater than the JPEG version size, there won’t be a WebP version of the image created. In other words, there is no file size advantage to using WebP in such cases.

    Hopefully the above is of use. Let me know if you have any further questions on this.

    Thread Starter Diiamo

    (@luislu)

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to set set Webp quality?’ is closed to new replies.