Tag Archives: phpMyAdmin

WordPress Cron Can Kill a Website

I have run into this several times now so I thought I would write a quick article on it. It seems that WordPress’s cron really mess up a website.  Too many cron events will slow down your website. It can even cause timeout errors and out of memory issues.

What is cron?

Cron is basically a system to run programs in the background operation of your website. For a detailed explanation find out more here: Cron Info.

WordPress cron runs every time someone goes to your website. This is great as many plugin creators design software to do all kinds of fun and interesting things with your website. The downside is that these cron tasks can add up if not properly cleaned up. The average WordPress blog creator may not even know this exists. Worse, it can get full of all kinds of useless or out of data cron jobs.

The trouble is all these cron jobs are still queried, and possibly run, every time someone goes to your website. Over time this will certainly slow down your site. Especially if you experiment with many different plugins as many of them will leave residual cron tasks when they are uninstalled.

Check the WordPress Cron

First check your the WordPress cron and see if there is an unreasonable amount of cron jobs.

What’s unreasonable? That can vary greatly but I would say over 50 and you probably have too many. On my latest website with issues there were almost 20,000! Hard to say where they came from, but they needed to be cleared out!

First and foremost always backup your database when doing anything in it.

I prefer to go directly into the database with phpMyAdmin. Run the following SQL query.

This will retrieve the record of your cron jobs. In the option value field you will see something like this.

The only thing you really need to worry about is the very beginning of this entry. It will tell you how many cron jobs are present. In this case, there are 20.

In my case it looked like this.

19722! Yikes. This was pretty much crashing the website. Good news though. It is really easy to fix. Simply delete the cron entry and because of the magic and quality of WordPress the cron will be rebuilt the next time someone goes to your website. Easy as that!

Now you may need to go though and check your plugins, anything that schedules tasks, and verify that they are still scheduled and working. In most cases they will be. If not, set up the task again. These are things like calendars, auto backups, auto posts etc. All of these are done through cron jobs.

There is also a pretty cool plugin you can use to look at your cron jobs in a more UI friendly way.

https://wordpress.org/plugins/wp-crontrol/

Hopefully this helps you clean up and speed up your WordPress site!

VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

Manually Change WordPress Theme to Default in Database

Here is how to manually change the WordPress theme to a default (Twenty Fifteen) in database. Do not use this method if you are not familiar with manually editing your WordPress Database in phpMyAdmin.

The three option_name rows in the database that need to be changed. These are what control which theme is currently active on your WordPress website.

  • template – the “Theme Name” as defined in style.css
  • stylesheet – the actual name of your theme folder
  • current_theme -the actual name of your theme folder

CREATE A BACKUP OF YOUR DATABASE BEFORE YOU BEGIN!

This tutorial on how to manually change WordPress theme to default assumes that the prefix of your database is wp_. If it isn’t, make sure to change the code presented below to match.

SQL to Find WordPress Theme Settings

First, run this to see what the current theme is set in your WordPress website.

Copy this information to somewhere safe. This is so you can quickly revert or change it later if you would like to.

SQL to Change Theme to Default in WordPress

Make sure that you have the default theme for WordPress loaded into /wp-content/themes/. For this example I am using the Twenty Fifteen WordPress default theme.

This works with ANY theme. Just make sure the theme files are loaded into your website.

Run the following code. Change ‘twentyfifteen’ to whatever WordPress theme you are using if not Twenty Fifteen.

Problems Changing WordPress Theme Default Manually

The most common problems are:

  • Typo in SQL
  • Missing Theme Files
  • Cached Page – Purge or Disable Cache

Please let me know if I missed anything or if you have additional tips.

This is a really handy fast trick to use to fix a WordPress website that you cannot access normally. Manually changing WordPress theme to default in the database is a fast and great way to test out and debug your website.

VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)