[wp-trac] [WordPress Trac] #14989: wrong attachment menu_order(wp_get_attachment_image_src)

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 29 10:19:41 UTC 2010

#14989: wrong attachment menu_order(wp_get_attachment_image_src)
 Reporter:  o----o         |       Owner:                             
     Type:  defect (bug)   |      Status:  new                        
 Priority:  normal         |   Milestone:  Awaiting Review            
Component:  Accessibility  |     Version:  3.0.1                      
 Severity:  normal         |    Keywords:  wp_get_attachment_image_src

 When a user uploads the image or images through the common back-end WP
 creates the Gallery with these images.
 But if the user do not setup the order all images have the menu_order is
 If he once reorder the images then the first image has all of sudden
 menu_order "1" not zero like before.

 Now, if anyone wants to get the first image in the template using for ie.
 wp_get_attachment_image_src he'll go for the menu_order "0", which can be
 OK, when there is only one picture, and user never "reordered" it, or many
 unordered, which is way worst, because all of them has "0".

 I think this is not supper sensitive bug, but It might confuse many users.
 The workaround is simple indeed. We can check if there is image with
 menu_order "0" if yes then we ask for the "0" and if not will try
 menu_order "1".. but why we have to do that?
 If the picture menu_order starts alway from "1" then the problem never
 (I know you don't want to confuse user in the back-end with 0 as first
 number, so I'm suggesting to use number "1" in the database)

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

More information about the wp-trac mailing list