I have managed to break something with my Wordpress Multisite install. I have tried deactivating every plugin and activating again. Right now I cannot click the Screen Options or Help in the dashboard Homepage. It works with the same user in the Multisite /network/.

But not on any other site with this specific user. I tried creating a new user, and that user could access everything.

So something must be screwed up in the database? What can I clear in the database to fix this?

Can you help me solve this?

Uncaught TypeError: $(...).wpColorPicker is not a function
at HTMLDocument.<anonymous> (admin-color-picker.js?ver=4.9.4:3)
at i (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,thickbox&ver=4.9.4:2)
at Object.fireWith [as resolveWith] (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,thickbox&ver=4.9.4:2)
at Function.ready (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,thickbox&ver=4.9.4:2)
at HTMLDocument.K (load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,thickbox&ver=4.9.4:2)

This is the function that brings the error:

add_action( 'admin_enqueue_scripts', 'theme_add_color_picker' );
function theme_add_color_picker( $hook ) {

if( is_admin() ) {

    // Add the color picker css file
    wp_enqueue_style( 'wp-color-picker' );

    // Include our custom jQuery file with WordPress Color Picker dependency
            /* wp_enqueue_script( 'wp-color-picker' ); /* CUSTOM - New line */
            /* Old line, brings an error in console (wrong path) */
    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' ) );


And this is the javascript (admin-color-picker.js):

// Add Color Picker to all inputs that have 'color-field' class

One weird part is that there is no file called custom-script.js at all in the theme directory!?

I tried deleting the function, the error is gone in the Console. But the dashboard still behaves the same, I cannot add or remove any widget, and Screen Options + Help is not clickable!

  • 2
    It sounds like an error in javascript has occurred, but without knowing what it was it's near impossible to help. Check out the Console in your browser dev tools to see what it is. Alternatively it could be a PHP error, check your PHP error logs to see what the actual problem is – Tom J Nowell Mar 8 '18 at 13:37
  • I agree with Tom. Additionally, if you only have the problem with just one user: do both user accounts have the same role? If so, maybe you can remove the 'broken' one and create a new account? – leendertvb Mar 8 '18 at 13:45
  • I updated the first post with the console error. It only appears at the dashboard startpage (the one you get to after logging in). Where do I start looking for the problem. I have checked admin-color-picker.js and wpColorPicker is declared as a function there – jockebq Mar 8 '18 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.