Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Last active April 14, 2020 06:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zackkatz/48949a0c75d9bf03cb6fc0771fb5a5c1 to your computer and use it in GitHub Desktop.
Save zackkatz/48949a0c75d9bf03cb6fc0771fb5a5c1 to your computer and use it in GitHub Desktop.
Entry Revisions - Prevent adding revisions for a specific form
<?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