Opened 10 years ago
Last modified 7 years ago
#30150 new enhancement
apply_filters( 'image_size_names_choose' ) should be provided a named context
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
It's used in a variety of places, some that you may want to filter and others that you don't. Each instance of apply_filters( 'image_size_names_choose' )
should be passed a named context
Attachments (2)
Change History (10)
#2
follow-up:
↓ 3
@
10 years ago
Note that the filter is used three times in the wp_print_media_templates()
function.
An explicit context would probably work better than __FUNCTION__
, e.g. custom-background
, attachment-display-settings
, gallery-settings
, image-details
, etc.
#3
in reply to:
↑ 2
@
10 years ago
Replying to SergeyBiryukov:
An explicit context would probably work better than
__FUNCTION__
...
Yes, it is probably better to use an explicit context here. Thank you!
This ticket was mentioned in Slack in #core by danielbachhuber. View the logs.
10 years ago
#6
@
9 years ago
In #34981 I documented a performance issue that arise when removing sizes from the filtered array. This patch would help to avoid those problems. Maybe you want to consider another priority than »low«.
#7
@
9 years ago
- Priority changed from low to normal
Worth noting my comment on #34981.
Are there contexts other than wp_prepare_attachment_for_js()
where filtering this value is needed? Perhaps we should either move the filter out of wp_prepare_attachment_for_js()
and into the views being built from the size data returned by these AJAX requests, or allow a second parameter to be passed to wp_prepare_attachment_for_js()
which would return all available sizes.
Using magic constant FUNCTION for context