• Hi.

    Your script loads javascript in a way that is not compatible with non-classic set-ups, like Composer based installations.

    the code

    wp_register_script($this->_optionsPrefix.'main_js', site_url().'/wp-content/plugins/admin-category-search/js/adminSearch.js');

    wp_register_script($this->_optionsPrefix.$key, site_url().'/wp-content/plugins/admin-category-search/js/'.$key.'.js');

    generates urls to the WP directory, while the plugin is not installed there.

    if you use the preferred method of generating urls;

    wp_register_script($this->_optionsPrefix.'main_js', plugins_url( __DIR__ ) .'/js/adminSearch.js');

    wp_register_script($this->_optionsPrefix.$key, plugins_url( __DIR__ ) .'/js/'. $key .'.js');

    This is no longer an issue.

    this is because site_url does not respect the WP_CONTENT constant, while plugins_url does (via WP_PLUGIN_URL)

    Are you willing to update your plugin? considering it hasn’t been updated in a while. In other words; is this plugin still maintained?

The topic ‘Bug and Solution for loading the scripts’ is closed to new replies.