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


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.

If you’re not sure where to place this code I highly recommend you read How to create a WordPress plugin for your custom functions.


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