media_library_show_audio_playlist filter-hookWP 4.7.4

Allows showing or hiding the "Create Audio Playlist" button in the media library.

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.

Usage

add_filter( 'media_library_show_audio_playlist', 'wp_kama_media_library_show_audio_playlist_filter' );

/**
 * Function for `media_library_show_audio_playlist` filter-hook.
 * 
 * @param bool|null $show Whether to show the button, or `null` to decide based on whether any audio files exist in the media library.
 *
 * @return bool|null
 */
function wp_kama_media_library_show_audio_playlist_filter( $show ){

	// filter...
	return $show;
}
$show(true|false|null)
Whether to show the button, or null to decide based on whether any audio files exist in the media library.

Changelog

Since 4.7.4 Introduced.
Since 4.8.0 The filter's default value is true rather than null.

Where the hook is called

wp_enqueue_media()
media_library_show_audio_playlist
wp-includes/media.php 4316
$show_audio_playlist = apply_filters( 'media_library_show_audio_playlist', true );

Where the hook is used in WordPress

Usage not found.