• I want to limit posts and especially PAGES to 5 revisions.

    I know that its possible to do that with the Wp-Config file.

    I would rather do it through a custom plugin code snippet to afford a bit more flexibility.

    So, is this ALL that needs to be added to the boilerplate plugin file?

    if (!defined('WP_POST_REVISIONS')) {
        define('WP_POST_REVISIONS', 5);
     }

    Some people say its necessary to have this as a “Must Use” plugin. Why?

    • This topic was modified 4 years, 7 months ago by TWD.
    • This topic was modified 4 years, 7 months ago by TWD.
    • This topic was modified 4 years, 7 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 1 replies (of 1 total)
  • Hi, twd, I used a demo test site, test plugin and modified the number of post revisions constant provided in your code above, and it does appear to work.

    I would think that some may want it to be an MU plugin as according to https://www.ads-software.com/support/article/must-use-plugins/#features, MU plugins are

    Loaded by PHP, in alphabetical order, before normal plugins

    I would think if you wanted to make sure that no other plugins had defined the number of post revisions stored, you would use this route to ensure your code would define the constant before other plugins.

Viewing 1 replies (of 1 total)
  • The topic ‘Limit page revision versions with a code snippet’ is closed to new replies.