How to stop the AMP plugin from slowing down the WordPress backend

It’s fair to say that not nearly as many webmasters have embraced AMP (Accelerated Mobile Pages) as Google would have liked to have. While there are many issues with the technology itself and Google’s involvement, this article will only be covering an issue relating to the official AMP plugin, developed by the AMP Project Contributors, for WordPress.

Berate me as much as you want, but at the time I launched one of my websites, I needed AMP to unlock a few features, and I was also interested in trying every new technology. I’m now stuck with it, but I will at some time in the future almost certainly remove it to spare me the headache of keeping everything running smoothly.

Slow WordPress backend? It might be the AMP plugin

A few weeks back, I started to notice that my WordPress backend was increasingly getting slower and slower. This issue was especially noticeable when publishing or updating a post or article. Doing so would sometimes take one to two minutes to complete. For me, that was unacceptable.

I started my investigation by first enabling the Troubleshooting Mode on WordPress’ Health Check & Troubleshooting plugin (you will need to install the plugin to enable this mode as the built-in version doesn’t support it). After it had disabled all the plugins, I published a new article and it was online in a matter of seconds. This was good news, as it meant that I hadn’t messed something up in my WordPress installation and it was indeed a plugin causing the slowdowns in my WordPress backend.

The next step was to disable every plugin, one by one, and see which one is the root cause of my slowdowns. As it turned out, it was the official AMP plugin which was causing my issues. All the other plugins I had installed had no noticeable influence on the time it took to save a page.

Why the AMP plugin slows down the WordPress backend

A bit of research led me to this issue on GitHub, in which many describe the same problem I was experiencing. What happens is that if you’ve got the AMP plugin installed and you publish or update a post/page, it will validate it each time you hit the button (this is what developers call a loopback request). That validation uses up many resources and takes a considerable amount of time. Especially if you’re using a VPS, as I currently am, and not a dedicated web server.

How to “fix” the AMP plugin for WordPress

The solution to this issue luckily (you might say unluckily) isn’t to uninstall the AMP plugin and removing all AMP pages. What has to be done, is to replace the loopback request with asynchronously re-checking. I suggest you read through the issue on GitHub if the technical aspects are of interest to you. For now, I’m only going to tell you how to do this.

Fortunately, a developer has already fixed the issue and uploaded the code, which can be manually installed as a WordPress plugin without you having to edit a single line. To do so, visit the amp-async-validation.php Gist on GitHub and click on Download ZIP in the top right-hand corner, to download the plugin.

Installing the fix for the AMP plugin

With the plugin downloaded, you can add a new plugin and select Upload Plugin instead of searching one in the list. Search and select the ZIP file you downloaded in the previous step and click on Install Now.

With the AMP Async Validation plugin installed and activated there are no further settings for you to adjust. It will start working immediately. Go ahead and save one of your posts and enjoy a speedy WordPress backend once again!

About Liam Alexander Colman

Liam Alexander Colman has been working with GeneratePress for over two years and has built countless WordPress websites using it. In his personal setting, Liam maintains six websites. While not a developer, he has created innumerable GeneratePress Elements and is well versed in customizing the theme to his liking. Visit this link for more information and a showcase of his work.

Leave a comment