Console error, even if everything is working?

I get this error in my console when visiting the admin pages:

GET https://example/test/wp-content/plugins/home/account/public_html/wp-content/themes/mytheme-theme/inc/custom-script.js?ver=4.9.4 net::ERR_ABORTED

I have tracked down the error to the code below:

function theme_add_color_picker( $hook ) {

if( is_admin() ) {

wp_enqueue_style( ‘wp-color-picker’ );

wp_enqueue_script( ‘custom-script-handle’, plugins_url( ‘custom-script.js’, __FILE__ ), array( ‘wp-color-picker’ ), false, true );

wp_enqueue_script( ‘admin-color-picker’, get_template_directory_uri() . ‘/javascripts/admin/admin-color-picker.js’, array( ‘jquery’ ) );

}
}

The problem here is that custom-script.js isn’t available inside the /inc folder, and it is nowhere in the theme-folder at all.
But the color picker works perfectly. And if I remove this line:

wp_enqueue_script( ‘custom-script-handle’, plugins_url( ‘custom-script.js’, __FILE__ ), array( ‘wp-color-picker’ ), false, true );

It will stop working all together.
So how come I get this error, but it still works?

Would like to have a clean console log.

Read more here:: Console error, even if everything is working?

Leave a Reply

Your email address will not be published. Required fields are marked *