OG:Image shouldn’t be WEBP | WordPress.org

Thread Starter


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);

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.

@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.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer