[wp-trac] [WordPress Trac] #35153: Default link target for media files is none

WordPress Trac noreply at wordpress.org
Wed Dec 23 16:55:31 UTC 2015


#35153: Default link target for media files is none
-----------------------------------+-----------------------------
 Reporter:  Clorith                |       Owner:  wonderboymusic
     Type:  defect (bug)           |      Status:  assigned
 Priority:  normal                 |   Milestone:  4.4.1
Component:  Media                  |     Version:  4.4
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  ui
-----------------------------------+-----------------------------
Changes (by eherman24):

 * keywords:   => has-patch 2nd-opinion


Comment:

 I've attached a first patch here. Sorry for posting two patches. The first
 one was linking to the attachment page, where it should have been linking
 to the actual media file itself.

 I've gone ahead and added a check when a media element is selected in the
 media library. If the selected media file's mime type is found in the
 array, the 'Link To' for the element sets to 'file' (Media File).

 Some additional feedback is needed, as I've defined a new array of default
 mime types to set the 'Link To' parameter to 'File'.

 {{{
 var mimeTypeDefaultLinkToAttachmentPage = [
    'pdf',
    'csv',
    'zip',
    'gz|gzip',
    'rar',
    '7z',
    'doc',
    'docx',
 ];
 }}}

 I got a list of acceptable mime types from the codex article
 get_allowed_mime_types()
 (https://codex.wordpress.org/Function_Reference/get_allowed_mime_types),
 under 'Default allowed mime types'.

 I'm sure additional mime types should be added to this list, but I'm not
 entirely sure which is best to have on this list and which is best left
 off.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35153#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list