Skip to content

Commit ad33967

Browse files
authored
gpi-disable-object-cache.php: Added new snippet to disable object cache in GP Inventory.
1 parent e63d66b commit ad33967

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Inventory // Disable Object Cache
4+
* https://gravitywiz.com/documentation/gravity-forms-inventory/
5+
*
6+
* GP Inventory caches objects to improve performance. This snippet disables object caching for a specific form.
7+
*
8+
* Instructions:
9+
*
10+
* 1. Install the snippet.
11+
* https://gravitywiz.com/documentation/managing-snippets/#where-do-i-put-snippets
12+
*/
13+
14+
15+
// This snippet disables object caching for a specific form.
16+
add_filter( 'gpi_should_cache_object', function ( $cache, $form_id ) {
17+
if ( $form_id === 123 ) { // Update "123" to your form ID
18+
return false;
19+
}
20+
21+
return $cache;
22+
}, 10, 2 );
23+
24+
// This snippet disables object caching for all forms.
25+
add_filter( 'gpi_should_cache_object', '__return_false' );

0 commit comments

Comments
 (0)