Title: Having issues related wp_enqueue_script
Last modified: September 22, 2023

---

# Having issues related wp_enqueue_script

 *  [pankajchhabra06](https://wordpress.org/support/users/pankajchhabra06/)
 * (@pankajchhabra06)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/having-issues-related-wp_enqueue_script/)
 * when i use wp_enqueue_script js script load in the page but if i use wp_enqueue_scripts
   it does not work
 *     ```wp-block-code
       <?php
   
       function my_custom_scripts()
   
       {
   
           $path = plugins_url('js/main.js',__FILE__);
   
           $ver = filemtime(plugin_dir_path(__FILE__).'js/main.js');
   
           wp_enqueue_script( 'my-custom-plugin', $path, array(), $ver, true );
   
       }
   
       add_action('wp_enqueue_scripts','my_custom_scripts');
   
       ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/having-issues-related-wp_enqueue_script/#post-17072494)
 * Review both:
    [https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/](https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/)
   [https://developer.wordpress.org/reference/functions/wp_enqueue_script/](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/having-issues-related-wp_enqueue_script/#post-17072606)
 * > when i use wp_enqueue_script js script load in the page
 * That’s all that it’s supposed to do. If the correct link reference appears in
   your page but the JS is not working, the issue is within your JS, not the enqueue
   process. But do verify in the page’s source HTML that the path to your main.js
   file is correct.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Having issues related wp_enqueue_script’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/having-issues-related-wp_enqueue_script/#post-17072606)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
