This issue can also result in you being locked out of the server altogether.
How to load jQuery Cookie on a server using mod_security
1. Log in to FTP or cPanel and rename two files inside the folder /plugins/woocommerce/assets/js/jquery-cookie/:
- rename jquery.cookie.js to jquery_cookie.js
- rename query.cookie.min.js to jquery_cookie.min.js
2. Inside the folder /wp-content/themes/ find theme which is in use, for example, twentyfourtee, and create blank file inside theme folder called custom-functions.php
3. Add the following lines inside your newly created file "custom-functions.php":
add_action( 'wp_enqueue_scripts', 'custom_frontend_scripts' );
function custom_frontend_scripts() {
global , ;
= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_deregister_script( 'jquery-cookie' ); wp_register_script( 'jquery-cookie', >plugin_url() . '/assets/js/jquery-cookie/jquery_cookie' . . '.js', array( 'jquery' ), '1.3.1', true );
}
Tip: You may also download our custom-functions.php.txt example file, and either rename it into custom-functions.php, or copy and paste the content into your existing custom-functions.php file.
4. Save the file.
Now the two javascript files won't produce 404 errors and trigger a mod_security exception.