[wp-trac] [WordPress Trac] #63577: PHP Warning from `get_post_galleries()` when gallery items lack an ID.

WordPress Trac noreply at wordpress.org
Thu Jun 19 23:35:59 UTC 2025


#63577: PHP Warning from `get_post_galleries()` when gallery items lack an ID.
-------------------------------------------------+-------------------------
 Reporter:  dd32                                 |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.9
Component:  Gallery                              |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  test-info                                      |
-------------------------------------------------+-------------------------

Comment (by dd32):

 @SirLouen I'm not sure :) But I made an assumption that it would be from
 old galleries converted to blocks OR that galleries could have arbitrary
 images in it.

 I was able to duplicate it with this post on WordPress.org:
 https://make.wordpress.org/training/2025/06/12/wordcamp-europe-2025
 -contributor-day-recap/

 Which has two galleries, one with attachments, and one with images that
 are embedded from a Google Doc (which is a different problem...).

 It seems that the Gallery block doesn't allow inserting images by URL
 (Only upload or from Media library) but it does seem to allow either
 pasting images which have an offsite URL or for an image to be grouped
 into a gallery when it's not a hosted image..

 {{{
 <!-- wp:gallery {"linkTo":"file"} -->
 <figure class="wp-block-gallery has-nested-images columns-default is-
 cropped">
 <!-- wp:image {"width":"188px","height":"auto"} -->
 <figure class="wp-block-image is-resized"><img
 src="https://lh7-us.googleusercontent.com/SZ0uE-
 B_Jz4GXspCylPqTywrpQKjjLFdtkGdP_-
 5nRakAwm1D3gtmbWhTSzOGIUhSdFrg5N4aGRR__MTz0qq1UQHgBfABPw4mG8RXvv5nDvHCXV9xJv500kRycJwlP3
 -x3hK_rixNX3y-Uf5QiA-eDc" alt="" style="width:188px;height:auto"
 /></figure>
 <!-- /wp:image -->

 <!-- wp:image {"width":"251px","height":"auto"} -->
 <figure class="wp-block-image is-resized"><img
 src="https://lh7-us.googleusercontent.com/-XTajDctcb-
 dNHbgt5HRe7ANRal2UlzeQIXjdVdw1iOU1K7pjbXFnUgpHv34dZvOOxC7L1bQOF_nZaLF94eYTRj9cAeQ96I_i9AiMc9IaPV_-
 rbvnrOU7oiQb_niNAVg1jN3-q1yX8HF-uFOCb0EySg" alt=""
 style="width:251px;height:auto" /></figure>
 <!-- /wp:image --></figure>
 <!-- /wp:gallery -->
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63577#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list