1

I was wondering if there is a way to override a FALSE wp_post_revisions configuration, by excluding specific posts upon user action, and have the database store revisions for those only.

Any ideas, how this can be implemented?

1 Answer 1

2

Since the check is made in wp_revisions_to_keep($post) in wp-includes/revision.php, and the result is run through a filter, you should be able to do something like this:

<?php
function wpse_289553($num, $post) {
        if(in_array($post->ID, array(123, 456, 789))) {
            return -1; 
        }
        return $num;
}
add_filter("wp_revisions_to_keep", "wpse_289553", 10, 2);

Set your post IDs in that array and adjust the returned number to how many revisions you'd like to keep. -1 means "all of them".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.