Skip to content

Commit a8cbf01

Browse files
committed
gpnf-gflow-auto-attach-child-entries.php: Added snippet to Auto-attach Child Entries to Parent when Editing via Gravity Flow.
1 parent 8a2d9f9 commit a8cbf01

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Nested Forms // Auto-attach Child Entries to Parent when Editing via Gravity Flow.
4+
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
5+
*
6+
* By default, when adding a new child entry to a Nested Form field while editing a parent entry via Gravity Flow, the
7+
* child entry is saved to the session and will not be attached to the parent entry unless you click "Submit" on the
8+
* workflow.
9+
*
10+
* Use this snippet to automatically attach the child entry to the parent as soon as the child form is submitted.
11+
*/
12+
add_filter( 'gpnf_set_parent_entry_id', function( $parent_entry_id ) {
13+
if ( ! $parent_entry_id && is_callable( 'gravity_flow' ) && gravity_flow()->is_workflow_detail_page() ) {
14+
$parent_entry_id = rgget( 'lid' );
15+
}
16+
return $parent_entry_id;
17+
} );

0 commit comments

Comments
 (0)