Opened 3 years ago
Last modified 12 months ago
#57760 new enhancement
add 'pre_wp_get_attachment_url' filter
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Media | Keywords: | has-patch |
| Focuses: | Cc: |
Description (last modified by )
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 (4)
#2
@
3 years ago
even jetpack also have problem hooking photon to wp_get_attachment_url()
https://github.com/Automattic/jetpack/issues/946
This ticket was mentioned in PR #7853 on WordPress/wordpress-develop by @liamfirth.
12 months ago
#4
- Keywords has-patch added
Adds pre_wp_get_attachment_url filter to short-circuit the wp_get_attachment_url function (allows better use of CDN, shared media library, external URLs, etc).
Trac ticket: https://core.trac.wordpress.org/ticket/57760
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