- Stato
- Risolto
- Risolto in
- WPML 4.4.4
Panoramica del problema
Durante l’utilizzo del componente aggiuntivo Gravity Forms Advanced Post Creation con WPML, in particolare nella schermata Post Creation, potresti riscontrare alcuni problemi, come menu a discesa e pulsanti che non rispondono.
Nella console del browser, troverai alcuni errori JavaScript come
Uncaught Error: Option 'ajax' is not allowed for Select2 when attached to a <select> element.
at String.<anonymous> (select2.min.js?ver=4.3.12:21)
at Function.each (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4.1:2)
at d.prepareOpts (select2.min.js?ver=4.3.12:21)
at d.prepareOpts (select2.min.js?ver=4.3.12:22)
at d.init (select2.min.js?ver=4.3.12:21)
at HTMLSelectElement.<anonymous> (select2.min.js?ver=4.3.12:22)
at Function.each (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4.1:2)
at a.fn.init.each (load-scripts.php?c=1&load[chunk_0]=jquery-core,jquery-migrate,utils&ver=5.4.1:2)
at a.fn.init.a.fn.select2 (select2.min.js?ver=4.3.12:22)
at HTMLDocument.<anonymous> (form_settings.min.js?ver=1.0-beta-4:1)
e
Uncaught TypeError: Cannot read property 'hasClass' of undefined
at HTMLDocument.<anonymous> (load-scripts.php?c=1&load[]=thickbox,hoverIntent,common,admin-bar,svg-painter,wp-auth-check,jquery-ui-datepicker,jquery-effects-core,jquery-effects-shake&ver=5.1.1:585)
at HTMLDocument.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:3)
at HTMLDocument.r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:3)
at Object.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:3)
at Object.a.event.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:8)
at HTMLDocument.<anonymous> (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:3)
at Function.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:2)
at a.fn.init.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:2)
at a.fn.init.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=5.1.1:3)
at Object.<anonymous> (heartbeat.min.js?ver=5.1.1:1)
Soluzione alternativa
Stiamo lavorando a una correzione più definitiva per questo problema, ma al momento puoi utilizzare la seguente soluzione alternativa:
Aggiungi questo snippet al file functions.php del tuo tema – ricordati di eseguire il backup della tua installazione di WP prima di farlo.
add_action('admin_enqueue_scripts', function(){
if (wp_script_is('gform_advancedpostcreation_select2')) {
add_action('wp_after_admin_bar_render', function(){
wp_dequeue_script('wpml-select-2');
}, 99);
}
}, 99);