Title: Not loading js file correctly
Last modified: September 1, 2016

---

# Not loading js file correctly

 *  Resolved [eppu](https://wordpress.org/support/users/eppu/)
 * (@eppu)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/not-loading-js-file-correctly/)
 * Hi,
 * I had a problem with loading of the .js file and I had to replace part of the
   code from /wp-content/plugins/wp-category-permalink/lib/ui.php from line 19
 * OLD:
 *     ```
       public static function enqueue_script()
           {
               $url = plugins_url('/wp-category-permalink.js', __DIR__ . '/../..' );
               wp_enqueue_script( 'wp-category-permalink.js', $url, array( 'jquery' ), '1.8', false );
           }
       ```
   
 * NEW:
 *     ```
       public static function enqueue_script()
           {
               $url = plugins_url('/wp-category-permalink.js', '/wp-category-permalink/' . '/..' );
               wp_enqueue_script( 'wp-category-permalink.js', $url, array( 'jquery' ), '1.8', false );
           }
       ```
   
 * The problem was that the .js file was not loading correctly. Structure was incorrect.
   Here is wat it looked like in the source:
    `<script type='text/javascript' src
   ='http://www.example.fi/example/wp-content/plugins/__DIR__/../wp-category-permalink.
   js?ver=1.8'></script>`
 * [https://wordpress.org/plugins/wp-category-permalink/](https://wordpress.org/plugins/wp-category-permalink/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * (@tigroumeow)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/not-loading-js-file-correctly/#post-7551680)
 * Hello,
 * Yes, that happens with an older version of PHP. Thanks for the quick fix 🙂 We
   fixed it another way, it will be push in the repo very soon. Thank you for finding
   this out.

Viewing 1 replies (of 1 total)

 The topic ‘Not loading js file correctly’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-category-permalink_161616.svg)
 * [WP Category Permalink](https://wordpress.org/plugins/wp-category-permalink/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-category-permalink/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-category-permalink/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-category-permalink/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-category-permalink/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-category-permalink/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Jordy Meow](https://wordpress.org/support/users/tigroumeow/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/not-loading-js-file-correctly/#post-7551680)
 * Status: resolved