File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
/**
3
- * Gravity Perks // Nested Forms // Disable Session Storage
3
+ * Gravity Perks // Nested Forms // Disable Sessions
4
4
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
5
5
*
6
6
* Instruction Video: https://www.loom.com/share/348e9e70999a43eaaf73cf0c820161aa
7
7
*
8
+ * Given how much data can be captured in a child entry, Nested Forms provides a safety net by storing
9
+ * submitted entry IDs in a cookie so that if the user accidently refreshes the page or closes the tab
10
+ * their submitted entries can be restored.
11
+ *
12
+ * If you would prefer that Nested Form fields function like other fields where the data is not preserved,
13
+ * use this snippet to disable Nested Forms sessions.
8
14
*/
9
- add_filter ( 'gform_pre_render ' , function ( $ form ) {
10
- if ( empty ( $ _POST ) && class_exists ( 'GPNF_Session ' ) ) {
11
- $ session = new GPNF_Session ( $ form ['id ' ] );
12
- $ session ->delete_cookie ();
13
- }
14
- return $ form ;
15
- } );
15
+ add_action ( 'wp_ajax_gpnf_session ' , 'gw_gpnf_disable_session ' , 9 );
16
+ add_action ( 'wp_ajax_nopriv_gpnf_session ' , 'gw_gpnf_disable_session ' , 9 );
17
+ function gw_gpnf_disable_session () {
18
+ remove_action ( 'wp_ajax_gpnf_session ' , array ( gp_nested_forms (), 'ajax_session ' ) );
19
+ remove_action ( 'wp_ajax_nopriv_gpnf_session ' , array ( gp_nested_forms (), 'ajax_session ' ) );
20
+ }
You can’t perform that action at this time.
0 commit comments