Opened 12 months ago
Closed 12 months ago
#20819 closed defect (bug) (fixed)
Restrict Media Library header image chooser to only images (no audio, video, etc)
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Appearance | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: |
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)
comment:1
SergeyBiryukov — 12 months ago
- Component changed from General to Appearance
- Keywords needs-patch added; 2nd-opinion removed
- Milestone changed from Awaiting Review to 3.4
SergeyBiryukov — 12 months ago
comment:2
SergeyBiryukov — 12 months ago
- Keywords has-patch added; needs-patch removed
SergeyBiryukov — 12 months ago
comment:3
SergeyBiryukov — 12 months ago
20819.2.patch also adds PHPDocs for the functions introduced in #19840.
We could also use one of our magic functions: __return_empty_array().
SergeyBiryukov — 12 months ago
comment:5
in reply to:
↑ 4
SergeyBiryukov — 12 months ago
Replying to ocean90:
We could also use one of our magic functions: __return_empty_array().
Indeed, thanks.
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed
In [20982]:
SergeyBiryukov — 12 months ago
comment:8
in reply to:
↑ 4
SergeyBiryukov — 12 months ago
- Resolution fixed deleted
- Status changed from closed to 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.
Can we simply do:
if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'custom-background' )
add_filter( 'media_upload_mime_type_links', '__return_empty_array' );
Yes, then we can remove the individual checks from attachment_fields_to_edit() and filter_upload_tabs() as well. Done in 20819.5.patch
SergeyBiryukov — 12 months ago
comment:11
ryan — 12 months ago
- Resolution set to fixed
- Status changed from reopened to closed
In [21009]:

Setting an audio file as header obviously results in a broken image when cropping and a warning: