Comment replies do not work

Comments don't work because of Cloudflare Rocket Loader

The reply link in the WordPress comments is not working properly? The reason for this is a JavaScript problem, which is often triggered by speed plugins or a CDN.

Here you will find the solution!

WordPress Comment Replies Not Working

Highlighted in yellow, the reply link to
Highlighted in yellow, the reply link to

Problem: When you click on the Reply link in the WordPress comments, nothing happens. The view just jumps down a bit. If you then scroll down to the comment form and reply, the comment is not ranked as an answer, but is inserted at the bottom.

Expected behavior: When clicking on the Reply link, the comment form should appear directly below the comment to be replied to. After submitting, the new comment can be seen indented under the parent comment.

Solution: Cloudflare Rocket Loader Ignore

I searched for a solution for a long time and first suspected my caching plugin WP Rocket. However, I was wrong.

Then it occurred to me that I use the Cloudflare CDN and have the Rocket Loader feature active, although problems with WordPress are known.

Cloudflare Rocket Loader enabled
Cloudflare Rocket Loader enabled

You can find the options in Cloudflare > Speed > Optimization > Rocket Loader.

After some tests, I was able to quickly narrow down the Rocket Loader as the cause of the problem.

But you should have Rocket Loader active, because the feature makes your WordPress site much faster!

So disabling the Rocket Loader is not an option. That’s why I was looking for a solution to the problem. Cloudflare itself has a help article that describes how to get the Rocket Loader to ignore certain JavaScript files. The following attribute must be added to the script tag: data-cfasync="false"

Perfect, that’s exactly what I need!

Directly in the theme or child theme, I don’t want to change that. So I need a WordPress filter that inserts the Attibut for me. I found what I was looking for on Stackoverflow.

To solve the problem, paste the following code into your functions.php file of your theme:

 * Make comment reply button work with CloudFlare Rocket Loader
 * @see
add_filter( 'script_loader_tag', 'add_data_attribute', 10, 3);
function add_data_attribute( $tag, $handle, $src ) {
  if ( 'comment-reply' !== $handle )
     return $tag;

return str_replace( ' src', ' data-cfasync="false" src', $tag );

What does the Rocket Loader do?

The Rocket Loader improves the paint times (time until what can be seen on the screen) for pages that contain Javascript. Visitors have a better experience if the content loads faster. Last but not least, speed is also a factor in some search rankings.

See also
How to install a WordPress plugin


  • Time to First Paint (TTFP)
  • Time to First Contentful Paint (TTFCP)
  • Time to First Meaningful Paint (TTFMP)
  • Document Load

Rocket Loader improves load times by asynchronously loading your JavaScripts, including third-party scripts, so these scripts don’t block the display of your pages’ content.

Why you should activate the Rocket Loader

JavaScript is both a blessing and a curse!

Without JavaScript, your page would load faster. That’s what we all want, don’t we?

Cloudflare’s Rocket Loader does a really good job of using JavaScript. You should definitely make use of this to offer your visitors a good user experience.

If there is a problem, as with the WordPress comment answers, there is always a solution.

Best WordPress Hosting

Hosting recommendations are usually garbage.

Often extremely cheap hosting packages for $ 3 are recommended, others advertise a $ 100 VPS, because they earn the most as an affiliate thereby. In the end, we all just want the fastest possible web space for as little money as possible.

And optimized for WordPress!

What else is important? The server should be a fast backbone for your website and the support should answer as fast as possible, and preferably in your language.

You can get all this at Cloudways from $ 10,00 / month.

Conclusion: Comment Reply does not work

WordPress errors are annoying and time-consuming because many plugins and external services make it massively difficult for troubleshooters. If the error is found, a solution still has to be found.

For the WordPress problem, the non-functioning of the answer link, the Rocket Loader from Cloudflare is to blame. With a short snippet in the functions.php, the problem can be easily solved.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *



  1. I have just started using cloudflare rocket loader on blogger site. It is awesome in terms of speed. But I am facing two issues – images doesn’t load on homepage before clicking on a post… 2nd HTML sitemap doesn’t load…. So I disabled… Now perfect… But I want to use it… Plz help me with a blog post… How to do that possible on infokaal. Com

    1. Hello Hussain,
      sorry, I have no experience with Blogger.
      Rocket Loader isn’t working in every setup.

    2. Thanks for this solution. However, it doesn’t work for me. The function doesn’t add the tag ‘data-cfasync=”false”‘ to the comment reply. After a few searches and tests, here is the code that has worked for me:

      function add_data_cfasync_attribute($tag, $handle, $src) {
      // Check if the handle matches the one you want to modify
      if ($handle === 'comment-reply') {
      // Modify the script tag
      $tag = str_replace( ' src', ' data-cfasync="false" src', $tag );
      return $tag;
      add_filter('script_loader_tag', 'add_data_cfasync_attribute', 10, 3);

  2. Thank you so much for this article. This ended my months of searching for a solution. Immediately I added the script to my functions.php file and cleared my cache, the reply button now works fine. 🙌🏽