wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_register_script › WordPress Function
Since2.1.0
Deprecatedn/a
› wp_register_script ( $handle, $src, $deps = array(), $ver = false, $args = array() )
| Parameters: (5) |
|
| See: |
|
| Returns: |
|
| Defined at: |
|
| Codex: | |
| Change Log: |
|
Registers a new script.
Registers a script to be enqueued later using the wp_enqueue_script() function.Source
function wp_register_script( $handle, $src, $deps = array(), $ver = false, $args = array() ) {
if ( ! is_array( $args ) ) {
$args = array(
'in_footer' => (bool) $args,
);
}
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
$wp_scripts = wp_scripts();
$registered = $wp_scripts->add( $handle, $src, $deps, $ver );
if ( ! empty( $args['in_footer'] ) ) {
$wp_scripts->add_data( $handle, 'group', 1 );
}
if ( ! empty( $args['strategy'] ) ) {
$wp_scripts->add_data( $handle, 'strategy', $args['strategy'] );
}
if ( ! empty( $args['fetchpriority'] ) ) {
$wp_scripts->add_data( $handle, 'fetchpriority', $args['fetchpriority'] );
}
return $registered;
}