[wp-trac] [WordPress Trac] #60932: Remove PHP capability-block from uploading webp and avif

WordPress Trac noreply at wordpress.org
Fri Apr 5 14:01:59 UTC 2024


#60932: Remove PHP capability-block from uploading webp and avif
-------------------------------+------------------------------
 Reporter:  Cybr               |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Media              |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  administration
-------------------------------+------------------------------
Changes (by adamsilverstein):

 * keywords:   => reporter-feedback


Comment:

 > Since images can still be served without editing them, this block should
 only be considered when actually editing the image.

 While this is technically true, users won't benefit from the subsizes and
 srcset WordPress automatically generates and - as @swissspidy points out -
 will suffer from the performance implications of always serving the
 original image. For most users uploading and using the original image is
 probably not best practice.

 That said, I can see a use case for it for some users, so it **should** be
 possible to bypass these checks as a developer or with a plugin. Looking
 at the code you referenced in media_upload_form, you should be able to use
 the `'plupload_init'` filter.

 Something like this (untested) code:
 {{{
 add_filter( 'plupload_init', function( $plupload_init ) {
     unset( $plupload_init[ 'avif_upload_error' ] );
     return $plupload_init;
 } );
 }}}

 @Cybr can you test this code snippet and see if that resolves the issue
 for you?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60932#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list