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
341           if ( $this->do_concat ) {
342                /**
343                 * Filters the script loader source.
344                 *
345                 * @since 2.2.0
346                 *
347                 * @param string $src    Script loader source path.
348                 * @param string $handle Script handle.
349                 */
350                $srce = apply_filters( 'script_loader_src', $src, $handle );
351
352                if (
353                     $this->in_default_dir( $srce )
354                     && ( $before_script || $after_script || $translations_stop_concat || $this->is_delayed_strategy( $strategy ) )
355                ) {
356                     $this->do_concat = false;
357
358                     // Have to print the so-far concatenated scripts right away to maintain the right order.
359                     _print_scripts();
 
Line Code
397           if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && str_starts_with( $src, $this->content_url ) ) ) {
398                $src = $this->base_url . $src;
399           }
400
401           if ( ! empty( $ver ) ) {
402                $src = add_query_arg( 'ver', $ver, $src );
403           }
404
405           /** This filter is documented in wp-includes/class-wp-scripts.php */
406           $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
407
408           if ( ! $src ) {
409                return true;
410           }
411
412           $tag  = $translations . $cond_before . $before_script;
413           $tag .= sprintf(
414                "<script%s src='%s' id='%s-js'%s%s></script>\n",
415                $this->type_attr,