Your  $scr should look like this using wp_register_script()

plugins_url( '/removeArrows.js' , __FILE__ )

wp_register_script( $handle, $src, $deps, $ver, $in_footer );

Another point of note, it is always good practice to load your scripts and styles last. This will ensure that it will not get overriden by other scripts and styles. To do this, just add a very low priority (very high number) to your priority parameter ($priority) of add_action.

 add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts', 999 ); 

And always load/enqueue scripts and styles via the wp_enqueue_scripts action hook, as this is the proper hook to use. Do not load scripts and styles directly to wp_head or wp_footer

For themes, your $scr would change to this

 get_template_directory_uri() . '/removeArrows.js'

for parent themes and this

get_stylesheet_directory_uri() . '/removeArrows.js'

for child themes. Your complete code should look like this

function wpb_adding_scripts() {
    wp_register_script('my_amazing_script', get_template_directory_uri() . '/removeArrows.js', array('jquery'),'1.1', true);

add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts', 999 ); 

And In a case th first script should be loaded only if another second script is loaded

function my_enqueue_scripts()
    wp_register_script( 'first', get_template_directory_uri() . 'js/first.js' );
    wp_enqueue_script( 'second', get_template_directory_uri() . 'js/second.js', array( 'first' ) );
add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts' );


Example of how to load an external script and making it jquery dependant:

add_action( 'wp_enqueue_scripts', 'radioco_streaming_scripts' );
function radioco_streaming_scripts() {
    wp_enqueue_script( 'radioco', '', array('jquery') );


Book Your Free Consultation

Submit your name and email below to schedule your free 15 minute initial consultation to see how we can help your business succeed