If you’re here just to find out how to export your Disqus comments and get them back into WordPress, I’ll cut a long story short and direct you to a Google Sheet that will provide you with the tools to do that. Click here.
If you’d like to find out more about how to debug WordPress performance issues, then carry on reading …
A WordPress blog I was maintaining had a serious pagespeed problem recently (we got reports with performance scores in the low 20s). That was a shock, and of course terrible for SEO. This is my story.
How to solve a WordPress performance issue
Step 1: Get some benchmarks
Benchmarks are useful because they level the playing field allowing you to make comparisons and track progress.
- Select a popular blog post to be the benchmark page for testing
- Run a pagespeed tool such as GTMetrix using this page to get a before benchmark
- Disable all the plugins in WordPress, and get another pagespeed metric for the same page
You must use the same blog post for all the pagespeed tests that you do. Every post on your blog could have difference performance problems – for example posts with embedded youtube videos would always score worse than a page that has only no embeds or images. So using the same page eliminates any content variance.
The before benchmark is easy to understand – this tells you how bad the current situation is.
The third benchmark (without any plugins) will give you a benchmark that helps you isolate the performance issues on your website. If it is acceptable to you, then it demonstrates that your performance issues lies with your plugins, and you can then use this metric as your north star metric.
If it is not acceptable, then there are more serious issues with your WordPress blog. The next most likely issue is with your WordPress theme. Some themes are not known for their performance, and other themes (especially with page builders such as Divi) allow novice developers to create heavy pages that load very slowly. Another potential (and common problem) is with your server – especially if you are using shared hosting. If hosting is your issue then GTMetrix will clearly indicate this with advice such as “Improve server response time”. Unfortunately I do not cover any of these issues in this blog post, but GTMetrix is very helpful and offers very explicit advice.
For my blog, we had a pagespeed of 94% without plugins and 54% with, so there was a lot to gain by moving onto the next step.
Step 2: Figure out which plugins are causing your performance issues
Start with your most critical plugins, and follow this process with each plugin
- Activate the plugin
- Run GTMetrix to get an after metric – record the metric
- Compare the metric to your before benchmark, Look at all the numbers to see
- Pagespeed & YSlow scores – this is your overall performance as evaluated by these two tools
- Fully loaded time – this number can fluctuate a bit, especially depending on your server and the amount of load it is experiencing – so this isn’t the most important number to focus on. GTMetrix says the average loading time is 8s.
- Total page size – this number tells you how data the user needs to download in order to see your page. GTMetrix reports average pagesize to be around 3Mb.
- Requests – this number tells you how many resources are used on your page. This includes CSS, javascript, images, cookies, etc – anything that is downloaded separately from the HTML. GTMetrix reports the average number of request as 89.
- Review the recommendations from Pagespeed and YSlow to see if the plugin is causing any new recommendations to appear (such as blocking resources, new redirects,etc).
Depending on the development of the tool, the metrics could vary significantly. A good tool should not cause the numbers to change dramatically and shouldn’t cause new warning recommendations to appear.
Step 3: Solve the performance problems
Once you have isolated the plugins with performance issues you then need to decide your plan of action.
Here are some options
- Remove the plugin – if the plugin is not critical to your website, this is your first prize, and of course the easiest route. Generally speaking, the fewer plugins a WordPress site has the better because plugins are often security issues, require updating, and of course sometimes cause performance issues.
- Replace the plugin – if the functionality of the plugin is important, but you can use another plugin then this is a great option. You are now able to test various plugins and then find one that doesn’t have such a large performance issue.
- Contact the plugin developer – this is a good option for paid-for plugins. If you are paying for a plugin you should contact the company or developer and ask for their feedback on the performance issues. Send the reports showing your website with the before and after metrics so they can see the impact their plugin is having on your website.
- Investigate lazy loading – some tools could be lazy loaded, so the tools resources aren’t requested when the page is loaded – they would only be loaded when the user scrolls to that part of the page. This works very well for tools such as Disqus which only need to be loaded when the user scrolls down to the bottom of the page. How to do this would depend on the tool itself, so I recommend searching for some answers.
- Investigate alternative ways to load the tool – some tools can be embedded into your website without the plugin which may be more efficient. Look at the instructions on how to integrate the tool into your website and see the other options. You could perhaps insert some code into your child theme. This worked for our OptinMonster plugin.
Disqus was one of the worst!
One of the plugins I decided to remove was Disqus – when it was activated, our pagespeed score dropped by 30% and the YSlow score by 23%. When I looked at the resources being loaded with the Disqus plugin I was shocked – over 100 extra requests (which were redirects) and 500Kb. When I looked into the redirects I could see requests coming from websites doing advertising and tracking such as:
- doubleclick.com
- adsymptotic.com
- rlcdn.com
- krxd.net
- amazon-adsystem.com
- … the list goes on and on
This was upsetting because we were supposed to have the paid version of Disqus, without advertising, but they were still tracking our users! And even though we were on a paid tier, they didn’t give us personal support – we were supposed to get help on the forums.
The final nail in the coffin for Disqus is that the blog did not receive very many comments (only a handful every week), so really this plugin was unnecessary.
If you’ve gotten this far, well done … here are the details you’ve been waiting for:
My Disqus Export Tool
The problem I soon discovered with Disqus is that although it’s easy to import your comments it isn’t always easy to export them.
The WordPress plugin has some functionality to sync comments, but unless you’ve had this running all the time, you can only get one years worth of comments. I couldn’t even get that to work. Their documentation mentions that you can export your comments in an XML format, but there seem to be a lot of caveats about the size of the export and requesting them. I also couldn’t find the option as described.
When I searched on sites such as Stackoverflow I found other people asking the same thing – how do I export comments from Disqus back into my WordPress database.
Nobody had any answers, except one person who gave some information about using the Disqus API to access your comments. This gave me the idea to write a script that would scrape all our Disqus comments. Once I had them scraped into a suitable format, it wouldn’t be too difficult to get them into our WP database.
I thought about writing it in Python, but because I’m very familiar with Google Apps Scripts, and I’d need to be working with CSVs anyway, it made sense to use that. It would also be easy to use. Afterwards I realised I could have done it with a WordPress plugin, but my PHP skills are remedial at best.
OKay, so here goes.
https://docs.google.com/spreadsheets/d/1CAdhn0t2tpj-HexEdcMbRnvcYD89wvXVq-5_k2gbAGI/edit?usp=sharing
Please start at the README tab and follow the steps in order, but basically this is what you need to do:
- Run a query in your WordPress database to get a list of all your blog posts
- Create your Disqus API application
- Fill in the details for your API / blog on the Settings sheet
- Run the script under the Add-ons menu option ‘Disqus Export’ -> ‘Start/Continue Disqus Export’ (you may need to repeat this a couple times)
- Run the query in your WordPress database to get the Disqus comments that are already saved in your WordPress database
- Run the script under the Add-ons menu option ‘Disqus Export’ -> ‘Generate WordPress SQL’
- Copy the SQL from the ‘Import SQL’ tab and run it in your WordPress database
- Update the comment_counts in the WordPress database
- Turn off the Disqus plugin and test
- Cancel your Disqus subscription.
Well done!!
Let me know if this tool is useful for you.