• Добрый день!
    Плагин ломает работу кастомайзера WP из-за ошибки js:

    Uncaught TypeError: widget.find(...).wpColorPicker is not a function
        at initColorPicker (customize.php?return=%2Fwp-admin%2Foptions-general.php%3Fpage%3Dcounter-yandex-metrica:2846)
        at HTMLDocument.onFormUpdate (customize.php?return=%2Fwp-admin%2Foptions-general.php%3Fpage%3Dcounter-yandex-metrica:2854)
        at HTMLDocument.dispatch (jquery.js?ver=3.5.1:5429)
        at HTMLDocument.elemData.handle (jquery.js?ver=3.5.1:5233)
        at Object.trigger (jquery.js?ver=3.5.1:8715)
        at HTMLDocument.<anonymous> (jquery.js?ver=3.5.1:8793)
        at Function.each (jquery.js?ver=3.5.1:381)
        at jQuery.fn.init.each (jquery.js?ver=3.5.1:203)
        at jQuery.fn.init.trigger (jquery.js?ver=3.5.1:8792)
        at child.embedWidgetContent (customize-widgets.js?ver=5.7.1:596)

    Здесь

    ( function( $ ){
        function initColorPicker( widget ) {
            widget.find( '.ymc-color-picker' ).wpColorPicker( {
                change: _.throttle( function() {
                    $(this).trigger( 'change' );
                }, 500 )
            });
        }

    Как я понял из некоторых статей про этот wpColorPicker – нужно убедиться, что он загружен, а потом уже его вызывать, т.е. явно указать зависимость в wp_enqueue_script()

  • The topic ‘wpColorPicker is not a function’ is closed to new replies.