PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/helpers/twitter/image-helper.php +6 -4 18.6 → trunk View file →
@@ -35,9 +35,9 @@
35 35 public function get_image_size() {
36 36 /**
37 37 * Filter: 'wpseo_twitter_image_size' - Allow changing the Twitter Card image size.
38 38 *
39 - * @api string $featured_img Image size string.
39 + * @param string $featured_img Image size string.
40 40 */
41 41 return (string) \apply_filters( 'wpseo_twitter_image_size', 'full' );
42 42 }
43 43
@@ -43,14 +43,16 @@
43 43
44 44 /**
45 45 * Retrieves an image url by its id.
46 46 *
47 - * @codeCoverageIgnore It is a wrapper method.
48 - *
49 47 * @param int $image_id The image id.
50 48 *
51 - * @return string The image url.
49 + * @return string The image url. Empty string if the attachment is not valid.
52 50 */
53 51 public function get_by_id( $image_id ) {
52 + if ( ! $this->image->is_valid_attachment( $image_id ) ) {
53 + return '';
54 + }
55 +
54 56 return $this->image->get_attachment_image_source( $image_id, $this->get_image_size() );
55 57 }
56 58 }