- สถานะ
- แก้ไขแล้ว
- แก้ไขใน
- WPML 4.4.4
ภาพรวมของปัญหา
ในขณะที่ใช้ส่วนเสริม Gravity Forms Advanced Post Creation ร่วมกับ WPML โดยเฉพาะในหน้าจอ การสร้างโพสต์ คุณอาจพบปัญหาบางอย่าง เช่น เมนูแบบเลื่อนลงและปุ่มไม่ตอบสนอง
ในคอนโซลเบราว์เซอร์ คุณจะพบข้อผิดพลาด JavaScript บางรายการ เช่น
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)
และ
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)
วิธีแก้ปัญหาชั่วคราว
เรากำลังดำเนินการแก้ไขปัญหานี้อย่างถาวร แต่ในขณะนี้คุณสามารถใช้วิธีแก้ปัญหาชั่วคราวดังต่อไปนี้:
เพิ่มโค้ดนี้ลงในไฟล์ functions.php ของธีมของคุณ โปรดอย่าลืมสำรองข้อมูลการติดตั้ง WP ของคุณก่อนดำเนินการ
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);