1. Homepage
  2. Codes
  3. How to Upload WEBP images in WordPress (Without Any Plugins)

How to Upload WEBP images in WordPress (Without Any Plugins)


Go To Appearnace>Theme editor> Functions.php> Paste the code at the bottom and save the file.

function webp_upload_mimes( $existing_mimes ) {
 // add webp to the list of mime types
 $existing_mimes['webp'] = 'image/webp';
 // return the array back to the function with our added mime type
 return $existing_mimes;
 }
 add_filter( 'mime_types', 'webp_upload_mimes' );
 //** * Enable preview / thumbnail for webp image files.*/
 function webp_is_displayable($result, $path) {
 if ($result === false) {
 $displayable_image_types = array( IMAGETYPE_WEBP );
 $info = @getimagesize( $path );
 if (empty($info)) {
 $result = false;
 } elseif (!in_array($info[2], $displayable_image_types)) {
 $result = false;
 } else {
 $result = true;
 }
 }
 return $result;
 }
 add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);

About Author

RipoN is a YouTuber by Hobbie and Blogger by Passion. He Loves to spread information that helps others to lives in this Digital World.

Write a Comment

Comments (5)

  1. 3 years ago

    THANKS BRO..

    AGAR wordpress post articles CONTENT 2000 ke upar ka hai to heading kaise aur kitane dene ke …. pls guide. thanks ..

  2. 3 years ago

    hello sir ,
    you created this website in previous month.
    After how many days techripon website got adsense approval.
    And after how many days ,and how many posts on site when you apply for adsense.
    please help me sir ,you are a big motivation for us.

  3. 2 years ago

    Bro Error Comming in Line 475 Linkha aa Rha h… Techreveals.in site h… And Adsense m bhi help kro please, mil hi ne rha…

  4. How you use this template in WordPress

  5. Wow, it works. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *