Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: script_loader_src

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
347           if ( $this->do_concat ) {
348                /**
349                 * Filters the script loader source.
350                 *
351                 * @since 2.2.0
352                 *
353                 * @param string $src    Script loader source path.
354                 * @param string $handle Script handle.
355                 */
356                $srce = apply_filters( 'script_loader_src', $src, $handle );
357
358                if (
359                     $this->in_default_dir( $srce )
360                     && ( $before_script || $after_script || $translations_stop_concat || $this->is_delayed_strategy( $strategy ) )
361                ) {
362                     $this->do_concat = false;
363
364                     // Have to print the so-far concatenated scripts right away to maintain the right order.
365                     _print_scripts();
 
Line Code
403           if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && str_starts_with( $src, $this->content_url ) ) ) {
404                $src = $this->base_url . $src;
405           }
406
407           if ( ! empty( $ver ) ) {
408                $src = add_query_arg( 'ver', $ver, $src );
409           }
410
411           /** This filter is documented in wp-includes/class-wp-scripts.php */
412           $src = esc_url_raw( apply_filters( 'script_loader_src', $src, $handle ) );
413
414           if ( ! $src ) {
415                return true;
416           }
417
418           $attr = array(
419                'src' => $src,
420                'id'  => "{$handle}-js",
421           );