- ステータス
- 解決済み
- 解決されたバージョン
- WPML 4.4.4
問題の概要
WPMLでGravity Forms Advanced Post Creation Add-Onを使用している場合、特に「Post Creation」画面において、ドロップダウンメニューやボタンが反応しないなどの問題が発生する可能性があります。
ブラウザーコンソールには、次のような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);