Fix: Microsoft Clarity WordPress plugin cause long page loading times

Microsoft Clarity WordPress plugin has a history of causing long page loading times from versions 0.10.5 to 0.10.7. This was fixed on 0.10.8, however a few versions later – in 0.10.10 the problem strikes again.

This time the Microsoft Clarity plugin slows down the WordPress admin side by constantly checking on the latest version of the plugin in each request.

Simple Workaround to fix problem with Microsoft Clarity plugin

Place this code in your WordPress theme functions.php file or add it in a must-use plugin. This code snippet will intercept and block the outgoing “version check” requests made by Microsoft Clarity plugin, therefore returning the loading speeds of the WordPress admin interface back to normal. You can use this safely while Microsoft Clarity plugin developers fixes the problem on their side:

<?php
add_filter('pre_http_request', function($preempt, $args, $url) {
   if(strpos($url, 'microsoft-clarity.json') !== false) {
      return ['response' => ['code' => 200, 'message' => 'OK']];
   }
}, 10, 3);
?>

Read more on how to block the outgoing requests in WordPress in order to improve the page loading speeds on your website.

Leave a Comment on Fix: Microsoft Clarity WordPress plugin cause long page loading times
About the author
I'm a full-stack WordPress developer with a 10+ years of solid experience in the core web development languages, development processes / techniques, web security, Linux server management and with pretty good understanding about proper semantics, UX/UI, technical SEO, good design and basic knowledge of company leadership. On top of that - a distant 5+ years experience as a computer and electronics repair technician which often enables me to understand also how the things work at the hardware level.
Your feedback matters!…
I hope you found this article helpful. Feel free to add some comments - your feedback is very important to me, as it drives my motivation and helps me to improve the content.