PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.12.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.12.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/frontend/class-seo-manager.php +7 -3 2.11.0 → 2.12.0 View file →
@@ -1799,12 +1799,16 @@
1799 1799 // Get image dimensions and alt text
1800 1800 $image_id = get_post_thumbnail_id($this->current_post_id);
1801 1801 $image_meta = wp_get_attachment_metadata($image_id);
1802 1802 if ($image_meta) {
1803 + // The `large` file being published, not the original it
1804 + // was generated from: the metadata's own width and height
1805 + // describe an image this tag does not point at (#847).
1806 + $image_file = \ThinkRank\SEO\Attachment_Lookup::describe((int) $image_id, (string) $image_url);
1803 1807 // SVGs (and other vector uploads) report 0x0 — emitting
1804 1808 // those as og:image dimensions is invalid, so skip them.
1805 - $og_width = isset($image_meta['width']) ? (int) $image_meta['width'] : 0;
1806 - $og_height = isset($image_meta['height']) ? (int) $image_meta['height'] : 0;
1809 + $og_width = $image_file['width'];
1810 + $og_height = $image_file['height'];
1807 1811 if ($og_width > 0 && $og_height > 0) {
1808 1812 echo "<meta property=\"og:image:width\" content=\"" . esc_attr($og_width) . "\" />\n";
1809 1813 echo "<meta property=\"og:image:height\" content=\"" . esc_attr($og_height) . "\" />\n";
1810 1814 }
@@ -1809,9 +1813,9 @@
1809 1813 echo "<meta property=\"og:image:height\" content=\"" . esc_attr($og_height) . "\" />\n";
1810 1814 }
1811 1815 // Derive the real mime type instead of hardcoding image/jpeg,
1812 1816 // which mislabels PNG/WebP featured images.
1813 - $image_mime = get_post_mime_type($image_id);
1817 + $image_mime = $image_file['type'];
1814 1818 if ($image_mime) {
1815 1819 echo "<meta property=\"og:image:type\" content=\"" . esc_attr($image_mime) . "\" />\n";
1816 1820 }
1817 1821 }