Last active
April 14, 2020 06:48
-
-
Save zackkatz/48949a0c75d9bf03cb6fc0771fb5a5c1 to your computer and use it in GitHub Desktop.
Entry Revisions - Prevent adding revisions for a specific form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Prevent adding revisions for a specific form | |
* | |
* @param bool $add_revision Should a revision be added? | |
* @param integer $entry_id The entry ID that was updated | |
* @param array $form The form object for the entry. | |
* @param array $original_entry The entry object before being updated | |
* | |
* @return bool Whether to add entry revisions | |
*/ | |
add_filter( 'gravityview/entry-revisions/add-revision', function( $add_revision = true, $entry_id, $form, $original_entry ) { | |
///// | |
// CHANGE 3 TO THE ID OF YOUR FORM BELOW | |
///// | |
if ( 3 === (int) $form['id'] ) { | |
return false; | |
} | |
return $add_revision; | |
}, 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment