WordPress and Paid Memberships Pro use a system called WP Cron to schedule events like the scripts that PMPro uses to manage membership expirations and queue up “expiring soon” emails.
PMPro v1.8.7 introduced a bug that was scheduling extra cron events… actually 3 extra events with every page load. On active sites (like our own site here), this quickly led to thousands of cron jobs being added, which would fill up the database and slow the site down to the point of failure.
It’s an incredibly nasty bug, and we’re very sorry to have introduced it.
Below is more information on who the bug affects and a few ways to clean it up. If you feel that the bug is affecting your site, and would like further help fixing this, please reach out in our member forums (fastest reply) or our contact form and we’ll resolve this for your site.
Who is this bug affecting?
- Sites that ran PMPro v1.8.7 or 126.96.36.199 for any length of time.
- Sites that are completely crashing.
- Sites running significantly slower than expected even after updating to PMPro v188.8.131.52.
PMPro 184.108.40.206 Contains a Cleanup Script
If your site is running and you are able to access the WordPress dashboard, upgrading to PMPro 220.127.116.11 will run a script to clean up the redundant cron jobs. In our tests, this script always cleaned up the extra crons without halting as long as WordPress was loading in the first place. But please let us know if you experience any issues after upgrading to 18.104.22.168.
You Can Also Run a Separate Cleanup Plugin
If you have access to your WordPress dashboard, but you’d rather not upgrade PMPro (although we think you should), you can run the plugin created by Thomas Sjolshagen specifically to clean up the extra PMPro Crons. Download the zip file here and then upload and activate the plugin. (Some people have reported that they have to activate the plugin twice.)
Fixing Via MySQL if You Cannot Access the WordPress Dashboard
If you cannot access your WordPress dashboard to upgrade PMPro or use the cleanup plugin, follow the instructions below to clean your cron jobs up. This is an advanced technique and should be done with care. If you use plugins that make large use of the WP Cron system (e.g. WooCommerce Subscriptions), you will definitely want to back up the database first or at least the “cron” row in the wp_options table. And you will want to take extra care before running the steps below.
- Back up your database and files through your host or a backup plugin [more info].
- Run the following SQL command to delete all scheduled cron jobs.
DELETE FROM wp_options WHERE option_name = 'cron';
Note that your DB prefix may be something other than wp_ so update the command with your proper options table name
- Alternatively, on one system we were fixing this on the DELETE command above didn’t work. The following update command did:
UPDATE wp_options SET option_value = '' WHERE option_name = '';
- If your website is still slow or not loading at this point, you should restart the Apache/HTTPD/NGINX/etc and MySQL/MySQLD services through your control panel or SSH.
- Deactivate and reactivate Paid Memberships Pro and any other plugin that you might need to have crons rescheduled for.
- Install the WP Crontrol plugin and go to Tools -> Scheduled Events to see what crons are scheduled. If you see a ton of redundant events with the same name/hook, then you might need to adjust and/or the SQL query above.
If your site is running fine, you can try to view the crons using a plugin like WP Crontrol to see if you really have an issue. And you can try to deactivate and reactivate Paid Memberships Pro, which will try to clear out the PMPro-specific crons. However, if there are a very large number of these, the deactivation may take your site off line. At which point, you should follow the steps above to fix the issue.
We’re committed to helping people fix things as quickly and painlessly as possible. If you need further help, please reach out in our member forums (fastest reply) or our contact form and we’ll resolve this for your site.