PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.11.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.11.0
2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk All 53 releases
← All changes | includes/seo/class-schema-builder.php +6 -7 trunk → 2.11.0 View file →
@@ -839,18 +839,17 @@
839 839 '@type' => 'ImageObject',
840 840 'url' => $image_url
841 841 ];
842 842
843 - // Try to get image dimensions if it's a WordPress attachment — those
844 - // of the file this URL names, which need not be the original upload.
845 - $attachment_id = Attachment_Lookup::id_from_url($image_url);
843 + // Try to get image dimensions if it's a WordPress attachment
844 + $attachment_id = attachment_url_to_postid($image_url);
846 845 if ($attachment_id) {
847 - $image_file = Attachment_Lookup::describe($attachment_id, $image_url);
846 + $image_data = wp_get_attachment_image_src($attachment_id, 'full');
848 847 // SVGs report 0x0 — omit the dimensions rather than emitting
849 848 // zeroes, which invalidate the ImageObject.
850 - if ($image_file['width'] > 0 && $image_file['height'] > 0) {
851 - $image_schema['width'] = $image_file['width'];
852 - $image_schema['height'] = $image_file['height'];
849 + if ($image_data && (int) $image_data[1] > 0 && (int) $image_data[2] > 0) {
850 + $image_schema['width'] = (int) $image_data[1];
851 + $image_schema['height'] = (int) $image_data[2];
853 852 }
854 853 }
855 854
856 855 return $image_schema;