WordPress.org

Make WordPress Core

Opened 21 months ago

Closed 8 weeks ago

#21538 closed enhancement (duplicate)

wp_get_attachment_image_src() is misnamed

Reported by: 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)

comment:1 SergeyBiryukov21 months ago

  • Component changed from General to Media

comment:2 c3mdigital20 months ago

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

comment:3 ocean908 weeks 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.