How to Upload WebP image in WordPress without Plugin Nepali

  • Go To Appearnace
  • then click Theme editor
  • click > 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);
How To Upload WebP Image In WordPress Without Plugin Nepali
Sharing Is Caring:

Salyan Tech - I Am LM Basu, Self Founder Salyan Tech Blog Site. This Blog About Online Earning.

Leave a Comment