PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.14.2
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.14.2
2.14.2 2.14.1 2.14.0 2.13.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 All 57 releases
← All changes | includes/seo/class-schema-builder.php +9 -13 2.10.0 → 2.14.2 View file →
@@ -839,17 +839,18 @@
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
844 - $attachment_id = attachment_url_to_postid($image_url);
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);
845 846 if ($attachment_id) {
846 - $image_data = wp_get_attachment_image_src($attachment_id, 'full');
847 + $image_file = Attachment_Lookup::describe($attachment_id, $image_url);
847 848 // SVGs report 0x0 — omit the dimensions rather than emitting
848 849 // zeroes, which invalidate the ImageObject.
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];
850 + if ($image_file['width'] > 0 && $image_file['height'] > 0) {
851 + $image_schema['width'] = $image_file['width'];
852 + $image_schema['height'] = $image_file['height'];
852 853 }
853 854 }
854 855
855 856 return $image_schema;
@@ -923,9 +924,9 @@
923 924 'organization_social_telegram'
924 925 ];
925 926
926 927 foreach ($social_fields as $field) {
927 - if (!empty($settings[$field]) && filter_var($settings[$field], FILTER_VALIDATE_URL)) {
928 + if (!empty($settings[$field]) && \ThinkRank\Core\Url_Validator::is_valid($settings[$field])) {
928 929 $social_profiles[] = $settings[$field];
929 930 }
930 931 }
931 932
@@ -1597,14 +1598,9 @@
1597 1598 $social_profiles,
1598 1599 static function ($url) {
1599 1600 return is_string($url)
1600 1601 && '' !== trim($url)
1601 - && filter_var($url, FILTER_VALIDATE_URL)
1602 - && in_array(
1603 - strtolower((string) wp_parse_url($url, PHP_URL_SCHEME)),
1604 - ['http', 'https'],
1605 - true
1606 - );
1602 + && \ThinkRank\Core\Url_Validator::is_http_url($url);
1607 1603 }
1608 1604 )));
1609 1605
1610 1606 if (!empty($social_profiles)) {