diff --git a/wp-graphql-yoast-seo.php b/wp-graphql-yoast-seo.php index fcfea18..77138ef 100755 --- a/wp-graphql-yoast-seo.php +++ b/wp-graphql-yoast-seo.php @@ -77,8 +77,13 @@ function wp_gql_seo_get_og_image($images) if (!isset($image['url'])) { return __return_empty_string(); } - - return wpcom_vip_attachment_url_to_postid($image['url']); + // Remove image sizes from url + $url = preg_replace( + '/(.*)-\d+x\d+\.(jpg|png|gif)$/', + '$1.$2', + $image['url'] + ); + return wpcom_vip_attachment_url_to_postid($url); } } if (!function_exists('wp_gql_seo_get_field_key')) {