Make WordPress Core

Opened 5 months ago

Last modified 3 months ago

#61133 reviewing defect (bug)

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

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: antpb's profile antpb
Milestone: 6.7 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 (6)

#1 @azaozz
5 months 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.


4 months ago
#2

  • Keywords has-patch added; needs-patch removed

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


3 months ago

#4 @antpb
3 months ago

  • Milestone changed from Awaiting Review to 6.7

#5 @antpb
3 months ago

  • Owner set to antpb
  • Status changed from new to reviewing

@deepakrohilla commented on PR #6728:


3 months ago
#6

@peterwilsoncc : Thanks for the review. Suggested changes has been done.

Note: See TracTickets for help on using tickets.