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
310           if ( $this->do_concat ) {
311                /**
312                 * Filters the script loader source.
313                 *
314                 * @since 2.2.0
315                 *
316                 * @param string $src    Script loader source path.
317                 * @param string $handle Script handle.
318                 */
319                $srce = apply_filters( 'script_loader_src', $src, $handle );
320
321                if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle ) ) {
322                     $this->do_concat = false;
323
324                     // Have to print the so-far concatenated scripts right away to maintain the right order.
325                     _print_scripts();
326                     $this->reset();
327                } elseif ( $this->in_default_dir( $srce ) && ! $conditional ) {
328                     $this->print_code     .= $this->print_extra_script( $handle, false );
 
Line Code
368           if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $this->content_url && 0 === strpos( $src, $this->content_url ) ) ) {
369                $src = $this->base_url . $src;
370           }
371
372           if ( ! empty( $ver ) ) {
373                $src = add_query_arg( 'ver', $ver, $src );
374           }
375
376           /** This filter is documented in wp-includes/class.wp-scripts.php */
377           $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
378
379           if ( ! $src ) {
380                return true;
381           }
382
383           $tag  = $translations . $cond_before . $before_handle;
384           $tag .= sprintf( "<script%s src='%s'></script>\n", $this->type_attr, $src );
385           $tag .= $after_handle . $cond_after;
386