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
108           if ( $this->do_concat ) {
109                /**
110                 * Filter the script loader source.
111                 *
112                 * @since 2.2.0
113                 *
114                 * @param string $src    Script loader source path.
115                 * @param string $handle Script handle.
116                 */
117                $srce = apply_filters( 'script_loader_src', $src, $handle );
118                if ( $this->in_default_dir($srce) ) {
119                     $this->print_code .= $this->print_extra_script( $handle, false );
120                     $this->concat .= "$handle,";
121                     $this->concat_version .= "$handle$ver";
122                     return true;
123                } else {
124                     $this->ext_handles .= "$handle,";
125                     $this->ext_version .= "$handle$ver";
126                }
 
Line Code
129           $this->print_extra_script( $handle );
130           if ( !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
131                $src = $this->base_url . $src;
132           }
133
134           if ( !empty($ver) )
135                $src = add_query_arg('ver', $ver, $src);
136
137           /** This filter is documented in wp-includes/class.wp-scripts.php */
138           $src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
139
140           if ( ! $src )
141                return true;
142
143           $tag = "<script type='text/javascript' src='$src'></script>\n";
144
145           /** 
146            * Filter the HTML script tag of an enqueued script.
147            *