Make WordPress Core

Opened 12 years ago

Closed 10 years ago

#21538 closed enhancement (duplicate)

wp_get_attachment_image_src() is misnamed

Reported by: rulatir's profile rulatir Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5
Component: Media Keywords:
Focuses: Cc:

Description

The function wp_get_attachment_image_src is misnamed. The name suggests that the function returns the URL for the src attribute of img tag, and this suggestion is so strong that it is practically impossible to remember that it in fact returns an array. I've just now been bitten by this for perhaps 50th time, and I have lost what amounts to days of debugging on finding out again and again that a function named ...get...src doesn't get src.

I suggest renaming to wp_get_attachment_image_attributes and forwarding+deprecating the old function.

Change History (3)

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Media

#2 @c3mdigital
12 years ago

  • Type changed from defect (bug) to enhancement
  • Version set to 2.5

#3 @ocean90
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #12238.

Deprecating such a popular function isn't a good idea, and instead of renaming we should create a new function.

Note: See TracTickets for help on using tickets.