Opened 14 years ago
Closed 14 years ago
#20819 closed defect (bug) (fixed)
Restrict Media Library header image chooser to only images (no audio, video, etc)
| Reported by: | georgestephanis | Owned by: | ryan |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Customize | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
Description
For 'Choose an image from your media library' users can select other media such as Audio or Video items
http://cloud.stephanis.info/3l0z1g2q003T4530230o
The URL query string preselects the 'Image' file type, but others can be 'Set as header'
Attachments (5)
Change History (16)
#1
@
14 years ago
- Component General → Appearance
- Keywords needs-patch added; 2nd-opinion removed
- Milestone Awaiting Review → 3.4
#4
follow-ups:
↓ 5
↓ 8
@
14 years ago
We could also use one of our magic functions: __return_empty_array().
#5
in reply to: ↑ 4
@
14 years ago
Replying to ocean90:
We could also use one of our magic functions:
__return_empty_array().
Indeed, thanks.
#8
in reply to: ↑ 4
@
14 years ago
- Resolution fixed
- Status closed → reopened
Replying to ocean90:
We could also use one of our magic functions:
__return_empty_array().
Actually, no. That hides the file type links when calling the uploader window on Edit Post screen as well.
We need to check for context, like filter_upload_tabs() and attachment_fields_to_edit() do:
http://core.trac.wordpress.org/browser/trunk/wp-admin/custom-header.php?rev=20982#L969
20819.4.patch fixes the issue and brings the same changes to custom-background.php.
#9
@
14 years ago
Can we simply do:
if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' )
add_filter( 'media_upload_mime_type_links', '__return_empty_array' );
#10
@
14 years ago
Yes, then we can remove the individual checks from attachment_fields_to_edit() and filter_upload_tabs() as well. Done in 20819.5.patch
Setting an audio file as header obviously results in a broken image when cropping and a warning: