Make WordPress Core

Opened 13 months ago

Last modified 10 months ago

#57760 new enhancement

add 'pre_wp_get_attachment_url' filter

Reported by: fodisery's profile fodisery Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

We are making plugin for featured image using external url.

If user gt featured image url via wp_get_attachment_url() there is no way for us to hook because wp_get_attachment_url hook will never called if the post is not 'attachment'. The only way for us to make it work via creating fake attachment which is complicated.

pre_wp_get_attachment_url filter will be very helpful in this case.

Change History (3)

#1 @fodisery
13 months ago

Real life problem:

https://wordpress.org/plugins/featured-image-from-url/
They solve this by creating fake attachment for each featured image, which waste of space.

https://wordpress.org/plugins/featured-image-by-url/
They stated plugin wont work if theme uses 'wp_get_attachment_url' to get featured image url

#2 @fodisery
12 months ago

even jetpack also have problem hooking photon to wp_get_attachment_url()
https://github.com/Automattic/jetpack/issues/946

#3 @sabernhardt
10 months ago

  • Component changed from General to Media
  • Description modified (diff)
Note: See TracTickets for help on using tickets.