how can add script function in wordpress
add_action('template_redirect', 'add_my_script');
function add_my_script() {
wp_enqueue_script('my-script', plugins_url('my-script.js', __FILE__), array('jquery'), '1.0', true);
}
add_action('template_redirect', 'add_my_script');
function add_my_script() {
wp_enqueue_script('my-script', plugins_url('my-script.js', __FILE__), array('jquery'), '1.0', true);
}