Improve WordPress Comments Load time when using Akismet: Adding an index to wp_comments

A customer of mine was seeing a 15 second load time on their WordPress site when clicking on “Comments”.

I installed Query Monitor and saw that the Akismet plugin was running the following SQL command on each comment.

SELECT COUNT(*) FROM wp_comments WHERE user_id = 1820 AND comment_approved = 1;

This query was to show how many comments the user had previously had approved. The query was taking 0.5 seconds per comment listed when you visit the “Comments” page. The page was taking around 15 seconds to load at times. Now if you had this page set to load 100 comments per page, then you’re looking at 60 seconds.

I decided to run an explain on the query to figure out what was going on.

explain SELECT COUNT(*) FROM wp_comments WHERE user_id = 778 AND comment_approved = 1;

Which resulted in the following. (Sorry for the screenshot, copy/pasting and reformatting was not something I wanted to do. Also this references the wp_bspr_comments. This is due to the database having a wp_bspr for it’s table prefix.

MySQL Explain on wp_comments query not indexed

As you can see, the query is having to go through 19866 rows within the wp_comments table which is the total amount in the table. Since they’re using count(*) all rows are scanned.

So I decided to add an index for the user_id and comment_approved columns.

create index wp_comments_askismet ON wp_comments (user_id,comment_approved);

No when running an explain, there are only 9 rows scanned.

MySQL Explain on wp_comments with Aksimet after index

Load times were reduced dramatically. However, this can all be mitigated if you simply turn of the Akismet feature.

Akismet option to show number of approved comments beside each comment author.

WHMCS and Hexonet ISPAPI Registrar Module “Missing Required Attribute; X-CA-LEGALTYPE” Issue

If you’re running WHMCS and the Hexonet ISPAPI Registrar Module, you might have issues registering .ca domain names. An error will show up when you click on register, here’s a screenshot of the error.


Invalid attribute value; INVALID Contact [OWNERCONTACT] (Missing required attribute; X-CA-LEGALTYPE)]

This is due to the .ca registry requiring all registrations require a legal type designation, there’s multiple types. Commonly used types are Canadian Citizen and Corporation.

The fix is to open up the file “modules/registrars/ispapi/additionaldomainfields_sample.php” which is either in the downloadable zip file or already in your WHMCS installation. The file contains the following additions domain fields that you need to place under “WEBROOT/resources/domains/additionaldomainfields.php”

## add ispapi additional fields ##
$additionaldomainfields[“.ca”][] = array(
“Name” => “Legal Type”,
“LangVar” => “catldlegaltype”,
“Type” => “dropdown”,
“Options” => “Corporation,Canadian Citizen,Permanent Resident of Canada,Government,Canadian Educational Institution,Canadian Unincorporated Association,Canadian Hospital,Partnership Registered in Canada,Trade-mark registered in Canada,Canadian Trade Union,Canadian Political Party,Canadian Library Archive or Museum,Trust established in Canada,Aboriginal Peoples,Legal Representative of a Canadian Citizen,Official mark registered in Canada”,
“Default” => “Corporation”,
“Description” => “Legal type of registrant contact”,
“Ispapi-Name” => “X-CA-LEGALTYPE”,
$additionaldomainfields[“.ca”][] = array(
“Name” => “CIRA Agreement”,
“LangVar” => “catldciraagreement”,
“Type” => “tickbox”,
“Description” => “Tick to confirm you agree to the CIRA Registration Agreement shown below
You have read, understood and agree to the terms and conditions of the Registrant Agreement, and that CIRA may, from time to time and at its discretion, amend any or all of the terms and conditions of the Registrant Agreement, as CIRA deems appropriate, by posting a notice of the changes on the CIRA website and by sending a notice of any material changes to Registrant. You meet all the requirements of the Registrant Agreement to be a Registrant, to apply for the registration of a Domain Name Registration, and to hold and maintain a Domain Name Registration, including without limitation CIRA’s Canadian Presence Requirements for Registrants, at: CIRA will collect, use and disclose your personal information, as set out in CIRA’s Privacy Policy, at:
“, “Required” => true, “Ispapi-Name” => “X-CA-ACCEPT-AGREEMENT-VERSION”, “Ispapi-Eval” => ‘if ( $value ) { $value = “2.0”; } else { $value = “”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “WHOIS Opt-out”, “LangVar” => “catldwhoisoptout”, “Type” => “tickbox”, “Description” => “Tick to hide your contact information in CIRA WHOIS (only available to individuals)”, “Ispapi-Name” => “OWNERCONTACT0X-CA-DISCLOSE”, “Ispapi-Eval” => ‘if ( $value ) { $value = “0”; } else { $value = “1”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Trademark Number”, “Type” => “text”, “Size” => “50”, “Default” => “”, “Required” => false, “Ispapi-Name” => “X-CA-DOMAIN-TRADEMARK”, “Ispapi-Eval” => ‘if ( $value ) { $value = “Y”; } else { $value = “N”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Contact Language”, “Type” => “dropdown”, “Options” => “English,French”, “Default” => “English”, “Ispapi-Name” => “X-CA-LANGUAGE”, “Ispapi-Options” => “EN,FR” );

Don’t Buy WeMo Smart Plugs

So I bought a 3 pack of the WeMo Smart Plugs in the hopes of yelling “Alex turn Bedroom Light Off” before bedtime. Instead of buying a Clapper, of which I’ve never seen in real life. 

Which was probably a better idea seeing as the WeMo Smart Plugs are notorious for disconnecting from Wifi or having general issues connecting with HomeKit.

There are tons of community posts about this issue on the WeMo community forums.

All the issues on the WeMo Community Forums

Unfortunately you can’t view the posts unless you register an account. Good luck, as their registration page is also broken.

WeMo Community Forums Registration Broken

I had bought the WeMo Smart Plugs based on The Wire Cutters Best Smart Switch review, of which WeMo is number one.

If you read the Disqus comments, you’ll see that’s not really the case. Most of the comments talk about how the WeMo is unreliable.

Oh and you’ll notice that sometimes after the WeMo is registered as a device in the mobile app. It’s unsecured Wifi is still active and you can still connect to it.


Anyone interested in the wemo mini please be aware that there is currently a security issue with the latest iteration of hardware. When using the latest version the setup network stays active after the device is setup. It may go away at first but will turn back on after the device loses power or loses connection to your router.
Belkin has told me they had a similar issue with their previous hardware last year and was able to fix it with a firmware update, but there is currently no fix for the current version.
Early replies from their technical support claimed that the setup network is “inactive” after setup, and that although it may broadcast the network no one can perform any actions with the device over this network after setup.
This is not true. The setup network can be connected to and the device can be operated by anyone connected to the setup network.
If you currently have the device, as of Feb 22nd 2019, there is currently no solution but to unplug your devices.
Please see details on the issue in their support form.

For now I’m going to do some research but would love to know what others are using and having success with!

Booster for WooCommerce Showing Hidden Item Meta

If you have the Booster for WooCommerce plugin enabled and have used their order items table, specifically “[wcj_order_items_table]”

You might see item meta that should be hidden. I’ve created a GitHub Gist that you can place into wp-content/plugins

Adding OVH Monitoring IP’s to Windows 2012 Server Firewall

If you login to the OVH control panel and notice that the monitoring is showing Red instead of Green, this is due to their monitoring servers not being able to connect to your VPS. You simply need to add their IP’s for monitoring that they provide in the control panel to your Windows 2012 VPS firewall.

The following command will add a new rule called “OVH Monitoring” and allow the remote IP’s specified in the OVH Control Panel.

netsh advfirewall firewall add rule name="OVH Monitoring" dir=in action=allow remoteip=",,,,"


OVH Public Cloud CentOS 7 Change Hostname

If you’ve tried to change the hostname on your OVH public cloud instance running CentOS 7, you may have had issues with it persisting after reboot.

Took me way to long to find this solution, but someone had already spent way too much time figuring it out.

This GitHub Gist explains it all

Basically you need to edit /etc/cloud/cloud.cfg and add “preserve_hostname: true” and then set your hostname using hostnamectl.

hostnamectl –transient set-hostname
hostnamectl –static set-hostname

Hope that helps and thank zmjwong!

CrashPlan Update 4.8 and Linux Headless Issues

An update to CrashPlan was rolled out at version 4.8 but no download files were available on their site for Windows. So if you’ve been trying to manage your Linux headless install and its failing, this might be why.

Here’s the release notes.

I don’t know how to kick off updates to CrashPlan on Windows manually, due to this update being pushed out by CrashPlan cloud.

Update 09/30/2016 @ 2:40PM

Was able to direct connect via port 4243 headless without issues.

Update 09/30/2016 @ 10:00AM

Tried accessing a Linux server running 4.8.0 with a Windows client running 4.8.0 with no luck. Essentially what you would call headless, this was over an SSH tunnel. Will try direct.

Update 09/30/2016 @ 9:15AM

Got a reply from CrashPlan on twitter.