WordPress – How to remove comment-reply.min.js from page source

By default WordPress loads a JavaScript file called comment-reply.min.js for each page load.

This will look something like

http://www.itsupportguides.com/wp-includes/js/comment-reply.min.js?ver=4.2.2

comment-reply.min.js is necessary if you are using WordPress as a blog and need the built in commenting features – but if you aren’t running a blog or are using a third-party commenting system such as Disqus it’s not necessary and can be removed.

Removing it will reduce the page load time and size marginally, but sometimes even the slightest improvement in page load time can be worth it.

The following code can be added to your themes functions.php file, it will stop the file from being inserted into your page.

Simply add the code anywhere after the opening <?php line

// DISABLE WORDPRESS COMMENTS JS

function disable_comment_js(){
    wp_deregister_script( 'comment-reply' );
         }
add_action('init','disable_comment_js');