TIElogremover Automated Log File Cleaner

TIElogremover is now a part of the free TIEtools plugin, available from the WordPress repository.

This extremely simple WordPress plugin does one job and only one job: it deletes three error_log files from the WP install web space.


As someone who has run a large number of sites in the past and dealt with enormous error logs full of useless crap (e.g. 2Gb of warning messages that didn’t affect site operation at all), I wanted an automated cleanup. This was doubly true for static or automated sites which never had any trouble but which generated a lot of red tape as they ran.

TIElogremover deletes three files by default:

  • ABSPATH\error_log
  • ABSPATH\wp-admin\error_log
  • ABSPATH\wp-content\error_log

“ABSPATH” is the root of the WordPress install (the one listed in the general settings screen), so the plugin works in sub-directories or nested WP installations. ABSPATH is defined in your wp-config file.

You can download or install the plugin from the WordPress Plugin Repository. You can, of course, donate to the development fund:

Although this plugin is “maintained”, there’s really nothing that needs maintaining: the main function is three lines long, with each line deleting a single file. It ain’t rocket science.

The plugin uses the wp-cron scheduler, running at most once per day. You can change this, but I wouldn’t recommend making it run any more frequently. If there is a major problem with your site, you will need the logs to track it; the daily schedule gives you time to switch the plugin off and (hopefully) still have some logs to use.

Personalising the plugin

If you want to change the files the plugin deletes or add new ones, you can edit the php file. Look for the do_remove_logs function. The structure of each deletion is extremely simple:

unlink(ABSPATH . 'filepath/filename');

So if you wanted to delete a file called “rubbish.log” in the wp-content\uploads directory, you would add a line like this:

unlink(ABSPATH . 'wp-content/uploads/rubbish.log');

Note the way the directory slashes are the other way around to Windows slashes and that there is no leading slash (the definition of ABSPATH includes one).

Bugs and requests

These are all handled through the WordPress Plugin repository and the associated forums.

Leave a Reply

Your email address will not be published. Required fields are marked *