[wp-trac] [WordPress Trac] #57270: I want disable some Image Formats (Without Plugin)

WordPress Trac noreply at wordpress.org
Sun Dec 4 04:07:23 UTC 2022


#57270: I want disable some Image Formats (Without Plugin)
-----------------------------+-----------------------------
 Reporter:  factstea         |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:  6.1.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Hi, Team

 I am running a website over wordpress while using MagazineNP Theme. My
 website is accepting JPG, PNG and all other image formats. But I want
 enable only Webp format. How Can i do that without plugin?

 I have added a code in additional CSS ::
 ==================================================
 add_filter(‘upload_mimes’,’restrict_mime’);
 function restrict_mime($mimes) {
 $mimes = array(
 ‘webp’ => ‘image/webp’,
 );
 return $mimes;
 }
 ==================================================
 But it dosent work. Please help me out in this. I want enable webp format
 only for images.  Whenever anyone try to upload anyother fotmat image then
 should not be done and he should see a massage something like, You can
 upload webp only or only webp is supported.

 I do not want make changes in docs like pdf, wordfile or etc. I want
 change in Image format only.

 Thanks
 FactsTea !!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57270>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list