I recently had some downtime and decided that I was going to give my website a quick once over. I ran the site through PageSpeed Insights and it came back with a score of… 15. Which is, to be honest, absolutely terrible. Digging through the list of errors, and there were a couple of quick fixes that stood out that could be addressed fairly quickly. I’ll get to them in a later post, but even after fixing these glaring issues, PageSpeed’s score only went up 1 or 2 points. In other words, the changes didn’t even make a dent in the performance of the site.
Discovering what was slowing down my site
I then turned to the network tab in Google Chrome, to see if something stood out. I came across a network request for /wp-json/contact-form-7/****/refill‘. This request took a whole second to finish, and the data returned was as far as I could tell, empty. So why was this request taking a whole second to finish and not returning anything?
Searching for this URL yielded a WordPress support thread, discussing the issue. Here other users of a plugin called Contact Form 7 asks why this is happening and why it is slowing down their sites so much. The author of the plugin explains in the thread that this happens when you have caching installed and this forces the CAPTCHA images to be refreshed. However, the response doesn’t really address the issue, in that there isn’t really a fix for it. I’m not even sure if disabling page-caching would solve this.
Addressing the problem
Searching around some more, I discovered WP FIX IT. They advocate for dropping the plugin altogether due to this error. And that is what I did. I changed the contact form to WP Forms, and my PageSpeed score increased by about 30-40 points.
I will note that in the WordPress support thread mentioned above, there are instructions for how to change the underlying PHP code, to stop this action from occurring. However, I can only assume that this code change is required whenever you update the plugin. Furthermore, I am not a big proponent of changing somebody else’s code without knowing what it does and how it affects the rest of the code base.