Opened 12 years ago
Last modified 8 years ago
#30150 new enhancement
apply_filters( 'image_size_names_choose' ) should be provided a named context
| Reported by: | danielbachhuber | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Media | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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
@
12 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
@
12 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.
11 years ago
#6
@
11 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
@
10 years ago
- Priority low → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Using magic constant FUNCTION for context