[wp-trac] [WordPress Trac] #41802: add wp_attachment_is_audio() and wp_attachment_is_video()
WordPress Trac
noreply at wordpress.org
Thu Aug 16 22:24:07 UTC 2018
#41802: add wp_attachment_is_audio() and wp_attachment_is_video()
-------------------------+------------------------------
Reporter: pbiron | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 4.9
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------------------
Comment (by SergeyBiryukov):
Re-reading #25275, deprecating `wp_attachment_is_image()` was indeed
suggested, but I don't think switching to a more generic function is a
strong enough reason to do that.
`wp_attachment_is()` was introduced as an alternative to duplicating the
same code in three different functions.
Since duplication is no longer a concern here, I don't have any objections
to adding these wrappers (maybe without replacing the existing
`wp_attachment_is()` usage though).
That said, introducing them means that any new formats added to
`wp_attachment_is()` in the future (e.g. `pdf`) would probably need a
corresponding `wp_attachment_is_*()` function for consistency.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41802#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list