[wp-trac] [WordPress Trac] #33979: Add filter for 'post_gallery_item'

WordPress Trac noreply at wordpress.org
Mon Jul 16 22:21:40 UTC 2018


#33979: Add filter for 'post_gallery_item'
--------------------------------+-----------------------
 Reporter:  lostmotionassembly  |       Owner:  antpb
     Type:  enhancement         |      Status:  assigned
 Priority:  normal              |   Milestone:  5.0
Component:  Gallery             |     Version:  4.4
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:
--------------------------------+-----------------------

Comment (by pbiron):

 we discussed the possibility of including this in 4.9.8 during today's bug
 scrub.  It was decided **not** to do so, because it was felt the latest
 patch (at that time) was missing a few things.

 [[https://core.trac.wordpress.org/attachment/ticket/33979/33979.4.diff|33979.4.diff]]
 addresses those things:

 1. filter should accept an array (instead of string) for `$classes`; this
 is for consistency with similar existing filters, e.g.,
 [[https://developer.wordpress.org/reference/hooks/post_class/|post_class]];
 1. filter return value cast to array() (just in case);
 1. `sanitize_html_class()` applied to each element in the filter return
 value array;

 Notice that `33979.4.diff` begins by passing an empty array to the filter,
 and then adds `gallery-item` in as the final step before the item's
 opening tag is added to the output.  I'd be OK doing it the way the
 previous patch did (i.e., passing `array( 'gallery-item' )` to the filter,
 but it seems safer to me to do it the way I did.

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


More information about the wp-trac mailing list