apply_filters( 'media_library_show_audio_playlist', bool|null $show )
- Since
- 4.7.4, 4.8.0
Allows showing or hiding the "Create Audio Playlist" button in the media library.
Description
By default, the "Create Audio Playlist" button will always be shown in the media library. If this filter returns null, a query will be run to determine whether the media library contains any audio items. This was the default behavior prior to version 4.8.0, but this query is expensive for large media libraries.
Compatibility
- WordPress
- since 4.8.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$showbool|null- Whether to show the button, or
nullto decide based on whether any audio files exist in the media library.
Where this hook fires · 1
wp-includes/media.php:4820wp_enqueue_media()
Source code
<?php * * @link https://core.trac.wordpress.org/ticket/31071 * * @param bool|null $show Whether to show the button, or `null` to decide based * on whether any audio files exist in the media library. */ $show_audio_playlist = apply_filters( 'media_library_show_audio_playlist', true ); if ( null === $show_audio_playlist ) { $show_audio_playlist = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type LIKE 'audio%'Changelog
Introduced in 4.7.4. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.8.0
The filter's default value is
true rather than null.from the docblock4.7.4
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.