Skip to content

Commit 1462450

Browse files
dmsnellwestonruter
andcommitted
Fix typo: use stored gallery ids, not the output list of ids
Co-authored-by: Weston Ruter <[email protected]>
1 parent 78f8d3e commit 1462450

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/wp-includes/media.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5386,9 +5386,15 @@ function get_post_galleries( $post, $html = true, $max_galleries = PHP_INT_MAX )
53865386

53875387
// Old Gallery block format as an array.
53885388

5389-
// If present, use the image IDs from the JSON blob as canonical.
5389+
/*
5390+
* If present, use the image IDs from the JSON blob as canonical.
5391+
* This is sourced above when the Block Processor first reaches
5392+
* the outer `gallery` block and saved for now; this is because
5393+
* once the Processor moves on to the inner text or inner blocks,
5394+
* the attributes are no longer accessible.
5395+
*/
53905396
if ( ! empty( $gallery_ids ) ) {
5391-
foreach ( $ids as $id ) {
5397+
foreach ( $gallery_ids as $id ) {
53925398
$url = wp_get_attachment_url( $id );
53935399

53945400
if ( is_string( $url ) && ! in_array( $url, $srcs, true ) ) {

0 commit comments

Comments
 (0)