Skip to content

Commit

Permalink
fix null url (#75)
Browse files Browse the repository at this point in the history
#60 Fix for error part of this issue
  • Loading branch information
ashhitch authored Nov 25, 2020
1 parent 3625820 commit df52cb9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wp-graphql-yoast-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down

0 comments on commit df52cb9

Please sign in to comment.