wp_audio_shortcode_library
Filter HookDescription
Enqueue preview scripts. These scripts normally are enqueued just-in-time when an audio 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-audio.php
View on GitHub
|
Hook Type | Filter |
Line Number | 135 |
Hook Parameters
This hook doesn't accept any parameters.
Usage Examples
Basic Usage
<?php
// Hook into wp_audio_shortcode_library
add_filter('wp_audio_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-audio.php:135
- How this hook is used in WordPress core
<?php
130 *
131 * @since 4.8.0
132 */
133 public function enqueue_preview_scripts() {
134 /** This filter is documented in wp-includes/media.php */
135 if ( 'mediaelement' === apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ) ) {
136 wp_enqueue_style( 'wp-mediaelement' );
137 wp_enqueue_script( 'wp-mediaelement' );
138 }
139 }
140
PHP Documentation
<?php
/**
* Enqueue preview scripts.
*
* These scripts normally are enqueued just-in-time when an audio 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-audio.php
Related Hooks
Related hooks will be displayed here in future updates.