reyhoun/acf-rgba-color

Js error in admin area after updating to WP 5.5

Opened this issue · 0 comments

Hey,
Get js error after Wordpress was updated to 5.5

Uncaught ReferenceError: wpColorPickerL10n is not defined

and I found fix for it here

if( is_admin() ){
	add_action( 'wp_default_scripts', 'wp_default_custom_scripts' );
	function wp_default_custom_scripts( $scripts ){
		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker-alpha.min.js", array( 'iris' ), false, 1 );
		did_action( 'init' ) && $scripts->localize(
			'wp-color-picker',
			'wpColorPickerL10n',
			array(
				'clear'            => __( 'Clear' ),
				'clearAriaLabel'   => __( 'Clear color' ),
				'defaultString'    => __( 'Default' ),
				'defaultAriaLabel' => __( 'Select default color' ),
				'pick'             => __( 'Select Color' ),
				'defaultLabel'     => __( 'Color value' ),
			)
		);
	}
}