• Resolved marcoskito

    (@marcoskito)


    hello, is there any filter to remove the message “converted to WebP is larger than original and has been deleted.”
    as the site has many images, it is necessary to restart the page when a large amount of this message appears, then I need to start the regeneration.
    If there is any filter to remove the message during the process, let me know.
    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hello @marcoskito,

    Thanks for your message.

    Use the following filter (remember to remove it after the operation):

    add_filter( 'webpc_convert_errors', function( $errors ) {
      return [];
    } );

    Best,
    Mateusz

    Thread Starter marcoskito

    (@marcoskito)

    Thanks, I have one last question.
    The filter replaces this
    add_filter(‘webpc_convert_error’, function($errorMessage, $errorCode) {
    return ($errorCode !== ‘larger_than_original’) ? $errorMessage : null;
    }, 10, 2);
    or do i need to put both when i need to regenerate the images?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @marcoskito The filter I entered will hide all errors. Your filter is even better and will only hide one specific error.

    Thread Starter marcoskito

    (@marcoskito)

    if you were to adapt the filter that indicates “converted to WebP is larger than original and has been deleted.”
    how will the filter be?
    at the moment I just want to hide these two problems.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @marcoskito Use the filter I gave, convert all images and remove the filter.

    Thread Starter marcoskito

    (@marcoskito)

    OK.
    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘filter to remove message’ is closed to new replies.