Make WordPress Core

Opened 6 weeks ago

Last modified 12 days ago

#61133 new defect (bug)

Update `get_attachment_link()` to return image URL when attachment pages are turned off.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.4
Component: Media Keywords: has-patch
Focuses: sustainability Cc:

Description (last modified by azaozz)

get_attachment_link() returns the URL for the attachment page. As these pages have been removed on new installs of WordPress the returned URL links to a page that subsequently redirects to the image. This produces unnecessary computing cycles and delays visitors reaching the eventual destination.

When attachment pages are turned off, the function should return the same value as wp_get_attachment_url().

Follow up to #57913.

Change History (2)

#1 @azaozz
6 weeks ago

  • Description modified (diff)
  • Keywords needs-patch added

Yep, makes sense to avoid the redirect and improve performance. Could potentially be a little unexpected when the link is not to an image but to another type of file, but seems this is the case already.

Also fixed a typo in the description, assuming the link is to ticket 57913 where this was implemented.

This ticket was mentioned in PR #6728 on WordPress/wordpress-develop by @deepakrohilla.


12 days ago
#2

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.