WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 13 days ago

#48421 new enhancement

Add $unfiltered param to wp_get_original_image_path() and wp_get_original_image_url() functions

Reported by: ianmjones Owned by:
Milestone: 5.4 Priority: normal
Severity: normal Version: 5.3
Component: Media Keywords:
Focuses: Cc:
PR Number:

Description

Since #48302 there are now both wp_get_original_image_path() and wp_get_original_image_url() functions that take an attachment id and return the original large pre-scaled image path or URL.

However, unlike wp_get_attached_file(), neither take an $unfiltered param.

This is problematic for plugins wanting to work with the local path or URL for an original file but either it or another plugin already implements filters that alter the wp_get_attached_file() or wp_get_attachment_metadata() results that both of these wp_get_original_image_* functions use.

Also, as per the wp_get_attached_file() and wp_get_attachment_metadata() functions, it would be good if the $unfiltered param meant the respective wp_get_original_image_path and wp_get_original_image_url filters were short-cut out and not run if $unfiltered is true.

Change History (1)

#1 @azaozz
13 days ago

  • Milestone changed from Awaiting Review to 5.4

As far as I see the $unfiltered params are somewhat crude way to pass context to these functions and filters (they were added quite some time ago). Perhaps it can be passed-through in wp_get_original_image_path(), but may be better to add support for full "context" there instead?

There's also no $unfiltered in wp_get_attachment_url(). Don't think introducing that is a good idea. Currently if a plugin wishes so, the filters can be bypassed by hooking-in early. The same code/method would still work for the new wp_get_original_image_url().

Note: See TracTickets for help on using tickets.