How to trigger feeds after editing an entry

When you edit an entry with GravityView, you might want to re-process the add-on feeds that the form has. This is useful for re-sending emails or sending updated entry data to services such as Zapier.

For that to happen, it's necessary to add a bit of code to your theme so after submitting the changes, GravityView tells Gravity Forms to process its feeds again.

Before you use this code:

  • If you are not sure how to add custom code to your theme, please take a look at this article.
  • The code samples below target specific forms by their ID. In those examples, it's the ID 100. Please make sure to change that to the specific form ID connected to your View.

Trigger all feeds from a specific form

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_feeds', 10, 3 );

function gravityview_trigger_feeds( $form = array(), $entry_id = array(), $object ) {
  
    if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}
  
	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
  
	gf_apply_filters( array( 'gform_entry_post_save', $form['id'] ), $object->entry, $form );
  
	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
    
}

When using the Zapier Add-On

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_zapier_feed', 10, 3 );

function gravityview_trigger_zapier_feed( $form = array(), $entry_id = array(), $object ) {
	
	if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );

	$Zapier = GF_Zapier::get_instance();
	$Zapier->maybe_process_feed( $object->entry, $form );

	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}

When using the WebHooks Add-On

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_webhooks_feed', 10, 3 );

function gravityview_trigger_webhooks_feed( $form = array(), $entry_id = array(), $object ) {

	if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );

	$GF_Webhooks = GF_Webhooks::get_instance();
	$GF_Webhooks->maybe_process_feed( $object->entry, $form );

	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}

When using the Slack Add-On

add_action( 'gravityview/edit_entry/after_update', 'gravityview_trigger_slack_feed', 10, 3 );

function gravityview_trigger_slack_feed( $form = array(), $entry_id = array(), $object ) {

	if ( 100 !== (int) $form['id'] ) { // replace 100 with your form ID
		return;
	}

	add_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );

	$Slack = GFSlack::get_instance();
	$Slack->maybe_process_feed( $object->entry, $form );

	remove_filter( 'gform_is_feed_asynchronous', '__return_false', 1294873 );
}

Priority is set to something unlikely to be used by other codes (1294873). Feel free to use a different priority.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.