Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#14989 closed defect (bug) (invalid)

wrong attachment menu_order(wp_get_attachment_image_src)

Reported by: o----o Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Accessibility Keywords: reporter-feedback
Focuses: Cc:



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 "0" 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 occurs. (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)

Change History (1)

#1 @nacin
7 years ago

  • Keywords reporter-feedback added; wp_get_attachment_image_src removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

We don't have enough information to go on here. By default they order by menu_order then ID. This makes sense. If there is no menu order, then it's the order it went into the DB. Otherwise, if one gets a menu order, then they all do.

Note: See TracTickets for help on using tickets.