Shorten the length of the log file for Simple History plugin

Code Snippet Related Categories

Reason for needing the Code Snippet

The Simple History plugin default history period is 60 days. The log includes not only user initiated changes to the website, but all the automated updates to plugins, etc. This can make the log file pretty large.

(This post was viewed 424 times) in the last month.)

What the Code Snippet does

This Simple History plugin PHP code snippet for the functions.php file lets you choose how long the history log period is.

The size of the database table for the plugin will depend on how much activity your site has. So small site, not much activity = smaller db. Large size, lots of activity = larger db usage.

Here's the Code Snippet

If you want to limit the number of days the log is stored, you can change this using a filter.

This and more examples in the examples are in the php file:

Add this to your functions.php or similar:

// Clear items that are older than a 7 days (i.e. keep only the most recent 7 days in the log)
add_filter('simple_history/db_purge_days_interval', function ($days) {
$days = 7;
return $days;

Limit search for phrases by using " " around the phrase

Subscribe to Code Snippet updates

You will get an email the morning after we post a new Code Snippet

Something went wrong. Please check your entries and try again.

Other Recent Code Snippets

Best plugin for backing up your WordPress site 1

Best plugin for backing up your WordPress site

Posted in , , , ,

BackWPup is what I’ve been using.    

Read More
coming soon

Wordbook vs. WordBooker – autopost to Facebook WordPress plugins

Posted in , , , , ,

This post is Under Construction

Read More

Post Format: Standard

Posted in

All children, except one, grow up. They soon know that they will grow up, and the way Wendy knew was this. One day when she was two years old she was playing in a garden, and she plucked another flower and ran with it to her mother. I suppose she […]

Read More
Boat Barco Texture

Post Format: Gallery

Posted in
Read More

Post Format: Gallery (Tiled)

Posted in

This is a test for Jetpack’s Tiled Gallery. Install Jetpack to test. This is some text after the Tiled Gallery just to make sure that everything spaces nicely.

Read More

Post Format: Image

Posted in


Read More

Pieter Hartsook

WordPress website coaching, design, implementation, support, and training. Background in Marketing Research and Communications. See my profile at:

Reader Interactions

Leave a Reply

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

Skip to content