How to remove JavaScript for replying to comments in WordPress if you don’t need it

Do you have a WordPress site that doesn’t have active comments? Do you use Disqus or another system that replaces the native WordPress commenting system?

Then you can remove the JavaScript that makes it possible to reply to comments, and thus, by having one less unnecessary script loading on all your pages, you will be able to further accelerate their speed.

Specifically, the script is this: /wp-includes/js/comment-reply.min.js

And the only thing you have to do to stop it from loading is to add this function to your optimizations plugin or to the functions.php file of the active theme:

function clean_header(){ wp_deregister_script( 'comment-reply' ); } add_action('init','clean_header');
Code language: JavaScript (javascript)

Note: Don’t do this optimization if you use the WordPress commenting system or it will be impossible for users to respond to comments.

How useful was this post?

Click on a smiley to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

Leave a Comment

Your email address will not be published.

Scroll to Top
Skip to content