Is there a function to set WP_POST_REVISIONS from a plugin instead of having to do it in config.php? I was thinking of doing this:
runkit_constant_redefine( 'WP_POST_REVISIONS', 0 );
but that puts a dependency on runkit being compiled in with PHP which I’m not sure is usual/typical.
I want to turn revisions off completely and I’d like my (narrow use, special purpose) plugin to be as “turnkey” as possible; not requiring other tweaks or manual adjustments.
2 Answers
- Create a no-revs.php
- Set the contents to
<?php defined('WP_POST_REVISIONS') or define ('WP_POST_REVISIONS', false);
- Place it in the Must Use Plugins Folder located at
wp-content/mu-plugins
.
Be warned; It is recommended that you to have at least 3 post revisions to avoid any loss of data.