Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Keep 10 revisions per post

Keeps the last 10 revisions of each post and page instead of every one, so the database doesn’t fill up with old versions.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category Performance
  • Tested with WordPress 7.1
PHP
<?php

// Change 10 to the number you want to keep (0 turns revisions off).
add_filter( 'wp_revisions_to_keep', static fn() => 10 );

Good to know

Older revisions are removed the next time a post is saved.

In these packs

  • Performance: Small changes that save the server and the browser some work.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.