How can I remove jquery from the frontside of my WordPress?

前端 未结 10 904
逝去的感伤
逝去的感伤 2020-12-29 02:33

My wordpress site is a bit heavy to download. On the frontend, its including jquery unnecessarily. In my firebug it looks like:

jquery.js?ver=1.3.2
         


        
10条回答
  •  感动是毒
    2020-12-29 02:59

    function my_init() {
        if (!is_admin()) {
            wp_deregister_script('jquery');
            wp_register_script('jquery', false);
        }
    }
    add_action('init', 'my_init');
    

    It's correct - removes jquery library js. Code from other answers removes all js (even js that your installed plugins adds)

    Tested on 4.3.1

提交回复
热议问题