When using ACF Pro, problems occur in Javascript. If ACF Pro is active, an outdated javascript library is loaded by ACF. This hook is used to bypass this problem with ACF.
Error
The following errors occur in the javascript, causing some problems in the backend of WordPress:
Uncaught Error: Option ‘ajax’ is not allowed for Select2 when attached to a <select> element.
Uncaught TypeError: Cannot read property ‘hasClass’ of undefined
Troubleshooting
Add Hook to functions.php, so the select2 version of ACF is raised to 4.0:
1 2 3 4 5 |
function my_acf_init() { acf_update_setting('select2_version', 4); } add_action('acf/init', 'my_acf_init'); |
Source: https://github.com/woocommerce/woocommerce/issues/12924
Alternative
If you do not use ACF but still have problems of this kind, you can try the following option and tick the box: