Make WordPress Core

Opened 2 years ago

Last modified 20 months ago

#61133 reviewing defect (bug)

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

Reported by: peterwilsoncc Owned by: antpb
Priority: normal Milestone: Future Release
Component: Media Version: 6.4
Severity: normal Keywords: has-patch
Cc: Focuses: sustainability

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 (9)

#1 @azaozz
2 years 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.


2 years ago
#2

  • Keywords has-patch added; needs-patch removed

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


2 years ago

#4 @antpb
2 years ago

  • Milestone Awaiting Review → 6.7

#5 @antpb
2 years ago

  • Owner set to antpb
  • Status new → reviewing

​@deepakrohilla commented on ​PR #6728:


2 years ago
#6

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

#7 @peterwilsoncc
2 years ago

  • Milestone 6.7 → 6.8

Looks like I gave some bad advice on the pull request (I forgot about inherited view permissions), moving this to the next milestone as I won't get a change to come back to it.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


20 months ago

#9 @peterwilsoncc
20 months ago

  • Milestone 6.8 → Future Release

This ticket was raised in a bug scrub earlier today, I'm going to move it of the 6.8 milestone as there are a few things to deal with regarding the handling of images with a non-public post status.

Note: See TracTickets for help on using tickets.