Skip to content

Commit

Permalink
Shortcodes: Fix warning when attachment src is false in shortcodes mo…
Browse files Browse the repository at this point in the history
…dule (#39601)

* Check if the attachment is false, to avoid warnings
  • Loading branch information
darssen authored Oct 3, 2024
1 parent 96eef0d commit 0784872
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Minor check to avoid Warnings


2 changes: 1 addition & 1 deletion projects/plugins/jetpack/modules/shortcodes/slideshow.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function shortcode_callback( $attr ) {
$gallery = array();
foreach ( $attachments as $attachment ) {
$attachment_image_src = wp_get_attachment_image_src( $attachment->ID, $attr['size'] );
$attachment_image_src = $attachment_image_src[0]; // [url, width, height].
$attachment_image_src = false !== $attachment_image_src ? $attachment_image_src[0] : ''; // [url, width, height].
$attachment_image_title = get_the_title( $attachment->ID );
$attachment_image_alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true );
/**
Expand Down

0 comments on commit 0784872

Please sign in to comment.