[wp-trac] [WordPress Trac] #8480: apply_filters('post_gallery', '', $attr) should be apply_filters('post_gallery', $attr);

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 4 00:57:42 GMT 2008


#8480: apply_filters('post_gallery', '', $attr) should be
apply_filters('post_gallery', $attr);
--------------------------+-------------------------------------------------
 Reporter:  chionsas.org  |       Owner:                                   
     Type:  defect        |      Status:  new                              
 Priority:  normal        |   Milestone:  2.7                              
Component:  Gallery       |     Version:  2.7                              
 Severity:  normal        |    Keywords:  gallery, shortcode, apply_filters
--------------------------+-------------------------------------------------
 When customizing the gallery shortcode functionality via 'post_gallery'
 filter,
 the filter function does not receive [gallery] shorttag inline arguments
 (eg. [shorttag columns="5"])

 This seems to be bacause of bogus parameters, sent to apply_filters()
 funcion on
 '''http://trac.wordpress.org/browser/trunk/wp-includes/media.php#L601'''

 Correct syntax, according to
 http://codex.wordpress.org/Function_Reference/apply_filters is:[[BR]]
 '''apply_filters($tag, $value);'''

 When that 601 line in wp-includes/media.php is changed to:[[BR]]
 '''$output = apply_filters('post_gallery', $attr);'''[[BR]]
 (that is, the second argument is removed), everything works as expected.

 It seems that the bug was made because of add_filter() funcion syntax that
 takes three parameters - tag, priority and argument count. This would
 explain the empty second argument.

 I don't consider this bug to be urgent, but as the fix is extremely
 simple, it could surely make the 2.7 final :)[[BR]]
 This affects 2.7RC1, 2.6x and (I beleive) all the way down to when gallery
 functionality was introduced.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8480>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list