media_library_show_video_playlist
Filter HookDescription
Allows showing or hiding the "Create Video Playlist" button in the media library. By default, the "Create Video 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 video items. This was the default behavior prior to version 4.8.0, but this query is expensive for large media libraries.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 4848 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool|null
|
$show
|
Whether to show the button, or `null` to decide based on whether any video files exist in the media library. |
Usage Examples
Basic Usage
<?php
// Hook into media_library_show_video_playlist
add_filter('media_library_show_video_playlist', 'my_custom_filter', 10, 1);
function my_custom_filter($show) {
// Your custom filtering logic here
return $show;
}
Source Code Context
wp-includes/media.php:4848
- How this hook is used in WordPress core
<?php
4843 * @link https://core.trac.wordpress.org/ticket/31071
4844 *
4845 * @param bool|null $show Whether to show the button, or `null` to decide based
4846 * on whether any video files exist in the media library.
4847 */
4848 $show_video_playlist = apply_filters( 'media_library_show_video_playlist', true );
4849 if ( null === $show_video_playlist ) {
4850 $show_video_playlist = $wpdb->get_var(
4851 "SELECT ID
4852 FROM $wpdb->posts
4853 WHERE post_type = 'attachment'
PHP Documentation
<?php
/**
* Allows showing or hiding the "Create Video Playlist" button in the media library.
*
* By default, the "Create Video 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 video items. This
* was the default behavior prior to version 4.8.0, but this query is
* expensive for large media libraries.
*
* @since 4.7.4
* @since 4.8.0 The filter's default value is `true` rather than `null`.
*
* @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 video files exist in the media library.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.