[wp-trac] [WordPress Trac] #43826: get_post_galleries() should return gallery blocks

WordPress Trac noreply at wordpress.org
Fri Jan 18 00:16:13 UTC 2019


#43826: get_post_galleries() should return gallery blocks
-------------------------------------------------+-------------------------
 Reporter:  pento                                |       Owner:  tellyworth
     Type:  task (blessed)                       |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.1
Component:  Media                                |     Version:  5.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  testing                                        |
-------------------------------------------------+-------------------------
Changes (by celloexpressions):

 * version:   => 5.0


Comment:

 `get_post_gallery_images()` and `get_post_gallery()` also call
 `get_post_galleries()`. Usage of these higher-level functions may be more
 common than [comment:11] indicates. `get_post_gallery_images()` returns
 the image `src`s, and this should continue working with new blocks so that
 themes don't have to rely on their own logic to locate classic and block
 galleries in content.

 As long as the returned data format/contents matches classic galleries,
 themes and plugins would expect this to work equally for classic and
 block-based galleries. A very common usage is to show gallery excerpts in
 theme archive views; these are often created by gathering data with this
 function, then reformatting a custom gallery excerpt with custom markup.
 It is not tenable to use a different function for block galleries unless
 all existing content is migrated to gallery blocks, since this usage needs
 to apply to pre- and post-5.0 galleries equally.

 [attachment:43826.diff] appears correct to me; however, I have not tested
 it.

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


More information about the wp-trac mailing list