A right way to Automated WordPress Website Maintenance, Here is how I automated my process of WordPress Website maintenance which will require my attention only when I want to write blog post but no extra time & effort to push more buttons elsewhere.

Assumptions, Prerequisites & Basic Knowledge

I assume that you have decent knowledge of web design & development including HTML, CSS for ice on cake working knowledge of PHP. I also assume that you have deployed your WordPress website on online live server.

Introduction to Automated WordPress Maintenance

This tutorial & my blog post will help you to automate your workflow of updating 100s of WordPress websites without any extra effort even when you are sleeping or working on your next big project your website will do all work for without any from your side. All scripts listed below will help you to automate updating of WordPress Major & Minor Core Source Code, Themes, Plugins, Database, WordPress site wide trash cleanup & SPAM Comments removal.

First Step: Towards Automated WordPress Source Code / Core update inclusion of official major & minor releases

WordPress.org introduced Automatic Minor Core updates in 3.7. This features remove hassle & extra step from updating website to next dot release of WordPress Website Installation.


Automatic Major Core Updates are not activated by default you have to modify your theme’s functions.php file by adding source code like this


// Enable major updates
add_filter( 'allow_major_auto_core_updates', '__return_true' );


Further Reading:

How to selectively or totally enable & disable ‘WordPress Automatic Background Updates’ while modifying code in WordPress root wp-config.php file & Your theme’s functions.php file

Second Step: Towards Automated WordPress Theme & Plugin Update / Management

WordPress Automatic update has feature where by you can selectively auto update WordPress Themes & Plugins as per your wish. First step is to disabled & enabled plugins that only you require to use daily for working of your website & other plugins that doesn’t require to run your website just delete it or at list disable it remove confusion & for simplicity of use. So incase of plugins & themes you should keep only files that you require & other just delete it.


You have to enable automated update for WordPress Themes & Plugins by implementing following code in your active theme’s functions.php file

Enable Automatic Plugin Updates


// Enable automatic updates for plugins
add_filter( 'auto_update_plugin', '__return_true' );

Enable Automatic Theme Updates


// Enable automatic updates for themes
add_filter( 'auto_update_theme', '__return_true' );


Futher Reading:

How to selectively or totally enable & disable ‘WordPress Automatic Background Updates’ while modifying code in WordPress root wp-config.php file & Your theme’s functions.php file

Third Step: Towards Successful WordPress Database Management & Performance

WordPress Post Revisions has more to do with database & database size. I just deleted my old WordPress over 1,000 Revisions & I just immediately reduced database size to 1/3 i.e one third of original database size.

Plugin Suggestion:

Plugin to manage Post Revisions: I used WP-Optimise WordPress Plugin to delete old post revisions with just few taps.

Source Code Update Suggestion:

As per we know WordPress Post Revision is a quite a old feature that was introduced long time back but it is now cost more to database size as it creates new revision i.e. backup of your post with every hit of save button & auto save done by WordPress itself. So naturally it over burdens installation with bloated database with useless backup data.

Solution & Implementation:

You can use following post revision code in your installation’s wp-config file to control how many revisions WordPress is allowed to make from unlimited to just 3 or 0 by disabling it to remove WordPress Post Revision Feature.


/* Limit the number of posts revisions that WordPress stores in the database */
define( 'WP_POST_REVISIONS', 3 );


Further Reading:

How to reduce MySQL Database size by managing WordPress Post Revisions count (WordPress Tip for Optimum Performance)

Fourth Step: Towards Total Comments & SPAM Removal Management

Plugin Suggestion: Akismet

Akismet is key to success, I have happy that Aksimet blocked around 53,000 of SPAM messages from my website by just activating for all of my websites by using their unique API key.


Note: I have checked & selected ‘Auto-delete spam submitted on posts more than a month old.’ in Akismet settings so that I don’t have to manually clean up SPAM detected by Akismet it will auto delete 30 day old SPAM on it’s own.

Source Code Update Suggestion:

Use following .htaccess code to limit direct access to wp-comments-post to limit spamming


# Block SPAM Comments

RewriteEngine On
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*your-website-name.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]


Further Reading:

Securing WordPress Installation & Boosting WordPress Website Performance with Easy .htaccess Code Settings or hacks (Note: This are the setting – hacks that I deployed on my website too)

Fifth Step: Automatically empty WordPress site wide trash to minimise blotting of WordPress Installation with Scrapped Data

Whenever you delete post. media, comments, themes, plugins it goes to WordPress Trash but it need another extra effort to press button to empty trash but you forgot it stays there for forever & it then blotts you installation by increasing database size by useless deleted data. So Idea here is to make WordPress Auto delete & empty trash by period of 10 days.


Implement following code to your website’s wp-config.php file to enable auto delete WordPress trash & auto empty it on regular basis


/* Automatically delete WordPress trash after 10 days */
define( 'EMPTY_TRASH_DAYS', 10 );


Further Reading:

How to Automatically Empty WordPress Trash including deleted posts, pages, attachments & comments from the WordPress trash bin? A small tweak for optimum performance & avoiding bloated WordPress installation with useless data.

Sixth Step: Empty ‘wp_commentsmeta’ table to speed up WordPress Website admin & visitor side load time

As I stated earlier plugin like ‘Akismet’ keep logs of comments in wp_commentsmeta database table which may cause conjunction & slow speed for loading website just by emptying this table for all top level domains & sub domains it can substantially can increase speed of your WordPress Website.

Note: You can perform this tsep once a year or only when wp_commentsmeta table get bloated with size more than 2 to 3 mb (Mega Bytes).


Further Reading: How to Fix ‘Warning: require_once() [function.require-once]: Unable to allocate memory for pool.’ Warning thrown at you while you were trying to login in your WordPress admin page.

So all above six steps that I mention that I use in my all WordPress website installations to Automate process of website mainatainance & removing any extra effort from my side & to stream line the process for years to come.

Hope this helps,

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply