Title: This plugin does not register it&#8217;s script correctly
Last modified: May 19, 2025

---

# This plugin does not register it’s script correctly

 *  [Tofandel](https://wordpress.org/support/users/tofandel/)
 * (@tofandel)
 * [1 year ago](https://wordpress.org/support/topic/this-plugin-does-not-register-its-script-correctly/)
 * The plugin registers it’s script with a hardcoded wp-content and plugin directory:
   `
   wp_register_script($this->_optionsPrefix.'main_js', site_url().'/wp-content/plugins/
   admin-category-search/js/adminSearch.js');`
 * 
   This is wrong and does not work in bedrocksThe correct way to register the script
   is ( it also doesn’t need to be both registered and enqueued, it can be enqueued
   straight away)`wp_enqueue_script($this->_optionsPrefix.'main_js', plugin_dir_url(_\_\
   _FILE\_\_ _) . 'js/adminSearch.js', array(), false, true);``wp_enqueue_script(
   $this->_optionsPrefix.$key, plugin_dir_url( _\_\_FILE\_\_ _) . 'js/'.$key.'.js',
   array(), false, true);`
    -  This topic was modified 1 year ago by [Tofandel](https://wordpress.org/support/users/tofandel/).
    -  This topic was modified 1 year ago by [Tofandel](https://wordpress.org/support/users/tofandel/).
    -  This topic was modified 1 year ago by [Tofandel](https://wordpress.org/support/users/tofandel/).

The topic ‘This plugin does not register it’s script correctly’ is closed to new
replies.

 * ![](https://ps.w.org/admin-search/assets/icon.svg?rev=2263465)
 * [Admin Search](https://wordpress.org/plugins/admin-search/)
 * [Support Threads](https://wordpress.org/support/plugin/admin-search/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-search/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Tofandel](https://wordpress.org/support/users/tofandel/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/this-plugin-does-not-register-its-script-correctly/)
 * Status: not resolved