Disable Object Cache

GP Inventory caches objects to improve performance. This snippet disables object caching for a specific form.

Instructions

Code

Filename: gpi-disable-object-cache.php

<?php
/**
 * Gravity Perks // Inventory // Disable Object Cache
 * https://gravitywiz.com/documentation/gravity-forms-inventory/
 *
 * GP Inventory caches objects to improve performance. This snippet disables object caching for a specific form.
 *
 * Instructions:
 *
 *  1. Install the snippet.
 *     https://gravitywiz.com/documentation/managing-snippets/#where-do-i-put-snippets
 */


// This snippet disables object caching for a specific form.
add_filter( 'gpi_should_cache_object', function ( $cache, $form_id ) {
	if ( $form_id === 123 ) { // Update "123" to your form ID
		return false;
	}

	return $cache;
}, 10, 2 );

// This snippet disables object caching for all forms.
add_filter( 'gpi_should_cache_object', '__return_false' );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.