How to reduce WordPress resource usage

How to reduce WordPress resource usage

 

1) Disable wp-cron:

 

To disable WP-Cron, add the following to your wp-config.php file, just before the line that says “That’s all, stop editing! Happy blogging.” Note: This disables it from running on page load, not when you call it directly via wp-cron.php.

 

define('DISABLE_WP_CRON', true);

 

Once done, you can create real cron from task scheduler using this command:

 

wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

 

If you’re not comfortable with setting up cron jobs on your server or your hosting provider doesn’t provide access, you can also use a third-party solution like EasyCron.

 

2) Disable WordPress heartbeat

 

You will need to install and activate the Heartbeat Control plugin. By default, heartbeat makes a post call every 15 seconds on post edit pages, and every minute on the dashboard. You can choose a higher frequency. Click on the save changes button to store your settings. That’s all you have successfully limited heartbeat API calls on your site.

 

3) Disable IP attacks on wp-admin page

 

Password protect the wp-admin folder.

 

Change WordPress username.

 

Update admin password to stronger one.

 

 

  • How to optimize your website, Use Compression technique:

 

You can add Apache mod_deflate directives to the .htaccess file which is located in your web application's root directory to compress output. Compression saves bandwidth and ensures faster page download times.

 

To enable output compression for your web application, follow these steps:

 

Using your preferred text editor, open or create the .htaccess file in the directory where you installed your application.

 

Add the following lines to the .htaccess file:

 

<IfModule mod_deflate.c>

 

AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript

 

</IfModule>

Using Browser caching:

The Apache mod_expires module enables you to instruct client web browsers how long to cache certain types of content. This both saves bandwidth and ensures faster page download times. To enable browser caching directives for your site, follow these steps:

 

Using your preferred text editor, open or create the .htaccess file in the directory where you installed your application. Add the following lines to the .htaccess file:

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/gif "access plus 1 month"

ExpiresByType image/jpeg "access plus 1 month"

ExpiresByType image/png "access plus 1 month"

ExpiresByType text/css "access plus 1 week"

ExpiresByType text/javascript "access plus 1 week"

ExpiresByType application/javascript "access plus 1 week"

ExpiresDefault "access plus 1 week"

</IfModule>

 

Save your changes.

 

 

  • Optimize Image files

 

You can use plugins like EWWW Image Optimizer or Minify to optimize images. Here are some other plugins:

 

Optimole.

 

Imagify.

 

Smush Image Compression and Optimization.

 

EWWW Image Optimizer.

 

ShortPixel Image Optimizer.

 

Compress JPEG & PNG images by TinyPNG.