What is WebP ?
WebP is a special image format for web. It’s provides lossless and lossy compression for image for web , which is makes website lighter and faster.

PNG : 42KB

WEBP : 20KB
WebP Support
WebP is natively supported in Google Chrome, Firefox, Edge, the Opera browser, and by many other tools and software libraries.
How to upload WebP in WordPress without Plugin ?
I will show you very simple steps to upload webp images on wordpress.
- Convert your any types images to WEBP formate images with online tools
2. Download webp converted image

WordPress doesn’t support Webp images by default, when you try to upload you can see this types error.

To fixed this problem First go to Dashboard and from Appearance > Theme Editor and Choose functions.php file and add this function bottom of this page and lasty hit save changes and don’t forget to take backup before doing this.
//** *Enable upload for webp image files.*/
function webp_upload_mimes($existing_mimes) {
$existing_mimes['webp'] = 'image/webp';
return $existing_mimes;
}
add_filter('mime_types', 'webp_upload_mimes');
Exactly same way add this code below previous code
//** * 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);
If this helpful for you, don’t forgot to share with others and feel free to comment below.