More

    How to Upload WEBP images in WordPress (no Plugins)

    hi, friend this mss studio tech today, I told you something, how to upload WEBP images in WordPress, ok guys are you excited to learn more about WordPress,

    //this is copyrighted by mssstudiotech.com
    
    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);

    1.Go to WordPress theme editor

    The is the First step to go to your website WordPress dashboard then go” Appearance “option pick a “Theme editor

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

    2.pick a function.php

    then go to the” theme files” options and then choose a “function.php” file ,download or copy code and pest a code in function.php file to the end

    if you have any doubt watching videos

    Leave a reply

    Please enter your comment!
    Please enter your name here