Filter hook 'wp_video_shortcode_library'

in WP Core File wp-includes/widgets/class-wp-widget-media-video.php at line 176

View Source

wp_video_shortcode_library

Filter Hook
Description
Enqueue preview scripts. These scripts normally are enqueued just-in-time when a video shortcode is used. In the customizer, however, widgets can be dynamically added and rendered via selective refresh, and so it is important to unconditionally enqueue them in case a widget does get added.

Hook Information

File Location wp-includes/widgets/class-wp-widget-media-video.php View on GitHub
Hook Type Filter
Line Number 176

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into wp_video_shortcode_library
add_filter('wp_video_shortcode_library', 'my_custom_filter');

function my_custom_filter() {
    // Your custom filtering logic here
    return 'modified_value';
}

Source Code Context

wp-includes/widgets/class-wp-widget-media-video.php:176 - How this hook is used in WordPress core
<?php
 171  	 *
 172  	 * @since 4.8.0
 173  	 */
 174  	public function enqueue_preview_scripts() {
 175  		/** This filter is documented in wp-includes/media.php */
 176  		if ( 'mediaelement' === apply_filters( 'wp_video_shortcode_library', 'mediaelement' ) ) {
 177  			wp_enqueue_style( 'wp-mediaelement' );
 178  			wp_enqueue_script( 'mediaelement-vimeo' );
 179  			wp_enqueue_script( 'wp-mediaelement' );
 180  		}
 181  	}

PHP Documentation

<?php
/**
	 * Enqueue preview scripts.
	 *
	 * These scripts normally are enqueued just-in-time when a video shortcode is used.
	 * In the customizer, however, widgets can be dynamically added and rendered via
	 * selective refresh, and so it is important to unconditionally enqueue them in
	 * case a widget does get added.
	 *
	 * @since 4.8.0
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 0
  • File: wp-includes/widgets/class-wp-widget-media-video.php
Related Hooks

Related hooks will be displayed here in future updates.