Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#39821 closed enhancement (duplicate)

Please make image extensions array filterable in wp_attachment_is()

Reported by: hinjiriyo's profile Hinjiriyo Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: Media Keywords:
Focuses: Cc:


The function wp_attachment_is()[1] checks the type of an attachment. While the checks for audio files and video files call subfunctions with filterable arrays of extensions [2][3] the check for image files uses a unfilterable - thus immutable - array.

1) make the array of image file extensions filterable like for audios and videos to let more image file formats allowed in WP
2) set that line in a subfunction just to be consistent with the functions for audios and videos, lets call it wp_get_image_extensions()

[1] wp_attachment_is() in /wp-includes/post.php
[2] wp_get_audio_extensions() in /wp-includes/media.php
[2] wp_get_video_extensions() in /wp-includes/media.php

Attachments (1)

39821.diff (479 bytes) - added by aaroncampbell 6 years ago.

Download all attachments as: .zip

Change History (5)

This ticket was mentioned in Slack in #core-media by mike. View the logs.

6 years ago

6 years ago

#2 @aaroncampbell
6 years ago

  • Keywords has-patch added

39821.diff Adds a filter inline, named to match the audio and video equivalents. I'm not sure there's a need to pull this out into a function like the others, aside from consistency.

#3 @kirasong
6 years ago

  • Keywords has-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks so much for the report!

Because this is currently in a milestone with a patch in #41801, going to mark this ticket as a duplicate for now.

If you think that ticket does not cover what you're asking for, please feel free to comment here and the ticket can be reopened.

#4 @Hinjiriyo
6 years ago

Hi @mikeschroder, thank you for your attention. I am glad that my old ticket will be continued in #41801.

Note: See TracTickets for help on using tickets.