• Resolved KC

    (@kaseym)


    Hi there,

    Any idea on getting it so that the webp featured image doesn’t go in the og:image spot (I’m using Yoast SEO) as this breaks some feeds etc.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter KC

    (@kaseym)

    I’ve come up with a dirty solution – does the trick.

    add_filter( 'wpseo_opengraph_image', 'change_opengraph_image_url' );
    
    function change_opengraph_image_url( $url ) {
        return str_replace('-jpg.webp', '.jpg', $url);
    }
    
    Plugin Support James Osborne

    (@jamesosborne)

    Hi @kaseym,

    Thanks for reaching out. As you’re using Yoast you can define your own OG:Image per post/page if you wish, selecting a JPEG or other version to suit your preference.

    If you don’t have a jpeg version of any uploaded images available this may be due to your media settings. You can ensure that there is both a jpeg and a WebP version of any images you upload available by selecting the respective option from your WordPress media settings (Settings > Media > Generate JPEG files in addition to WebP)

    If you wish to not use WebP images by default on all featured images going forward you can enable the above option, and then use the below filter. This ensures that when you upload a featured image the JPEG version will be used.

    remove_filter( 'post_thumbnail_html', 'webp_uploads_update_featured_image', 10 );

    If using the filter above, this should be added to a custom functions plugin, or a child themes functions.php.

    Hopefully the above is of use. Let me know if you have any further questions on this.

    Plugin Support James Osborne

    (@jamesosborne)

    @kaseym I’m just seeing your own solution now also. Nice work. As long as you have jpg versions generated alongside your webp versions that should also do it.

    Thread Starter KC

    (@kaseym)

    Thanks for following up!

    Interestingly, my WordPress is still keeping JPEGs even without that box ticked.

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the update @kaseym.

    After unchecking the “Generate JPEG files in addition to WebP” can you confirm that for all future uploads there are JPEG images also generated? The option won’t remove any previously uploaded JPEG images. Let me know anyway, while I also perform some checks on my side.

    Plugin Support James Osborne

    (@jamesosborne)

    Hi @kaseym,

    Just to let you know I’ve been performing some checks, and the “Generate JPEG files in addition to WebP” configuration option is working as intended from my side, using the latest version of the plugin.

    Note that where the confusion may lie is that the original JPEG image only will be visible from the file manager or FTP, but only the WebP versions and variations will be generated. You’ll find an example in this recording. Notice that all the versions of the upload image are WebP, with only the original remaining as a JPEG.

    If the option to “Generate JPEG files in addition to WebP” is enabled then you’ll encounter WebP and JPEG versions of each image and it’s size variation. You’ll see this evident from this recording.

    Let me know if you have any further questions on this.

    Hello,
    all images (og:image too) are generated as .webp, but I don’t want it, because some websites how tumbl, twitter, … are only support the imageFormat .jpg and .png. How could I deactive this function?

    The “Generate JPEG files in addition to WebP” isn’t showing under MediaSettings. Please help me.

    • This reply was modified 1 year, 8 months ago by manu87.
    • This reply was modified 1 year, 8 months ago by manu87.

    Sorry wrong plugin

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘OG:Image shouldn’t be WEBP’ is closed to new replies.