script_loader_src
Filter HookDescription
Returns contents of an inline script used in appending polyfill scripts for browsers which fail the provided tests. The provided array is a mapping from a condition to verify feature support to its polyfill script handle.Hook Information
File Location |
wp-includes/script-loader.php
View on GitHub
|
Hook Type | Filter |
Line Number | 199 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Scripts
|
$scripts
|
WP_Scripts object. |
string[]
|
$tests
|
Features to detect. |
Usage Examples
Basic Usage
<?php
// Hook into script_loader_src
add_filter('script_loader_src', 'my_custom_filter', 10, 2);
function my_custom_filter($scripts, $tests) {
// Your custom filtering logic here
return $scripts;
}
Source Code Context
wp-includes/script-loader.php:199
- How this hook is used in WordPress core
<?php
194 if ( ! empty( $ver ) ) {
195 $src = add_query_arg( 'ver', $ver, $src );
196 }
197
198 /** This filter is documented in wp-includes/class-wp-scripts.php */
199 $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
200
201 if ( ! $src ) {
202 continue;
203 }
204
PHP Documentation
<?php
/**
* Returns contents of an inline script used in appending polyfill scripts for
* browsers which fail the provided tests. The provided array is a mapping from
* a condition to verify feature support to its polyfill script handle.
*
* @since 5.0.0
*
* @param WP_Scripts $scripts WP_Scripts object.
* @param string[] $tests Features to detect.
* @return string Conditional polyfill inline script.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/script-loader.php
Related Hooks
Related hooks will be displayed here in future updates.