WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#36512 new defect (bug)

Color picker has disappeared from input in custom post type.

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

Description

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() {
        $('.color-field').each(function(){
          $(this).wpColorPicker();
        });
    });
     
})( 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 David THOMAS

Change History (2)

#1 @anou
2 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
2 years ago

  • Component changed from General to Administration
Note: See TracTickets for help on using tickets.