Your Gateway To Digital Success
Wesbytes Blue Logo

Wesbytes Knowledge Base

Search our articles or browse by category below

How to Fix High CPU usage in WordPress

Last modified: July 2, 2022
You are here:
Estimated reading time: 3 min

Fix High CPU usage in WordPress

You can learn how to handle the issue of high CPU utilisation in WordPress by reading this post. In addition, you can learn more about our hosting services. We encourage you to apply the following strategies:

Update WordPress

If you’re not using the latest version of WordPress update now. Make sure you backup your site first!

Update Plugins

Updating your WordPress plugins to the latest versions can often reduce high CPU usage. If you’re running an old version take a moment to update now.

Avoid beta versions of plugins

Whilst it’s cool to be at the cutting-edge, only use stable versions of WordPress plugins. Sometimes early release versions (also known as alpha or beta) can have bugs in the code which can cause CPU spikes.

Install a Caching Plugin

Caching plugins such as W3 Total Cache and WP Super Cache can dramatically reduce CPU load by caching static copies of your pages on your webspace. Static files use less CPU and memory. Keeping you within your shared hosting limits.

Disable WP-Cron

WP-Cron manages all the scheduled events on your WordPress site. WP-Cron is a very common cause of high CPU loads as it is called every time someone visits your website. Disabling WP-Cron and replacing it with a real cron job can drastically reduce CPU-load and prevent the chances your account is suspended due to exceeding your resources.

Only use plugins you really need

That plugin that continuously scans for broken links—do you really need it? – Your site will take longer to load if you have installed more WordPress plugins. Delete and deactivate any plugins you no longer require. Aim for no more than a few plugins. By doing this, you may speed up your website and keep visitors pleased.

If you’ve disabled all unnecessary plugins but your CPU utilisation is still excessive, you should try debugging each plugin to determine whether it’s to blame. First, ensure that a backup of your complete WordPress site has been made (files and database). Once the CPU burden has been reduced, try turning off each plugin one at a time. Hopefully, once you’ve identified the problematic plugin, you’ll be able to reenable the others without seeing the CPU problems.

Avoid resource-hungry plugins

If using WooCommerce, or similar resource-hungry plugins, make sure your web hosting has sufficient resources.

If you’re running CPU and Memory intensive plugins on a standard shared-hosting, or budget VPS hosting you may find your site performs badly due to insufficient server resources. Symptoms include slow loading pages, database errors and increased visitor abandonment.

With many web hosts, if you try running CPU intensive WordPress plugins on a shared-hosting package you risk your site being suspended due to high-CPU loads.

Avoid buggy WordPress Themes

A badly written WordPress Theme or one written with demanding features such as server-side image resizing can be CPU intensive. To rule out problems with your WordPress theme try the following:

  • Check error logs for problems. Login to cPanel and check the Error logs for errors.
  • Contact the theme developer and ask if there’s any known issues.
  • Disable any dynamic features built into the theme such as thumbnail resizing. Some WordPress themes have their own image resizing modules which can cause high CPU usage. If possible we recommend disabling them in favour of using the more efficient image resizing built into the WordPress core.

Ask the WordPress Community for help

Try searching WordPress Forums for answers. If there’s a known problem with a plugin there’s a good chance someone will have provided a solution. For example searching yarrp cpu has lot’s of hits.

You can disable WP-Cron by editing your wp-config.php and adding the following line;

define('DISABLE_WP_CRON', true);

You can create a cron job and run wp-cron.php every hour using the following command:

wget > /dev/null 2>&1

Replace with your web address

The cron job will ensure your WordPress site’s scheduled tasks get completed, such as scheduled posts, WP super cache garbage collection, etc.

Use PHP 7

Switching to PHP 7 can dramatically speed up your WordPress website, reducing loading time and freeing up CPU and memory. We recommend testing a staging version of your website with PHP 7 before changing the production version.

Increase PHP Memory Limit

Occasionally increasing the amount of memory available to your WordPress website can help fix high CPU errors in WordPress. We recommend increasing your PHP memory to at least 64MB, and recommend 256MB.

Was this article helpful?
Dislike 0
Views: 10