Make WordPress Core

Opened 6 years ago

Last modified 11 months ago

#36512 new defect (bug)

Color picker has disappeared from input in custom post type.

Reported by: anou Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5
Component: Administration Keywords:
Focuses: ui, javascript Cc:


In a custom plugin I've created some metaboxes with color picker fields.
Here how I call the color picker style :

add_action( 'admin_enqueue_scripts', 'le_chiffre_add_color_picker' );
function le_chiffre_add_color_picker( $hook ) {
  // $hook to apply a check for admin page.
  wp_enqueue_style( 'wp-color-picker' );  
  wp_enqueue_script( 'custom-script-handle', plugins_url( 'custom-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true ); 

the HTML input (created dynamically):

<input class="color-field" placeholder="#FFCC00" id="_chiffre_bgcolor" name="_chiffre_bgcolor" value="#c61d4c" size="" type="text">

and the js for my input fields, loading the color picker:

(function( $ ) {
    // Add Color Picker to all inputs that have 'color-field' class
    $(function() {
})( jQuery );

With WordPress 4.4.2 everything worked like a charm (I even did a reverse from 4.5 to 4.4.2 to be sure of it) and now with the 4.5 version, the color picker doesn't show up on my fields...

I didn't found anybody having the same issue.

Have a nice day

Change History (3)

#1 @anou
6 years ago

After some testing seems to be a more general javascript bug. the "modify" permalink on post edit form doesn't work and the "add media" either ...

Reverting to 4.4.2 is my only solution for now.

#2 @DrewAPicture
6 years ago

  • Component changed from General to Administration

This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.

11 months ago

Note: See TracTickets for help on using tickets.