Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save spivurno/35463f1d927860f2c86771db2e7a29dd to your computer and use it in GitHub Desktop.
Save spivurno/35463f1d927860f2c86771db2e7a29dd to your computer and use it in GitHub Desktop.
Gravity Perks // GP Nested Forms // Change Submit Button Text for Child Form
<?php
/**
* Gravity Perks // GP Nested Forms // Change Submit Button Text for Child Form
* http://gravitywiz.com/documentation/gravity-forms-nested-forms/
*/
add_filter( 'gform_pre_render_2', function( $form ) {
global $wp_current_filter;
if( ! is_callable( 'gp_nested_forms' ) ) {
return $form;
}
if( gp_nested_forms()->get_posted_entry_id() ) {
// Submit button text when editing an existing child entry.
$form['button']['text'] = 'Update Child Entry';
} else if( in_array( 'gform_get_form_filter', $wp_current_filter ) ) {
// Submit button text when adding a new child entry.
$form['button']['text'] = 'Add Child Entry';
}
return $form;
} );
@pinus2
Copy link

pinus2 commented May 7, 2019

does not work

@TrevorSqE
Copy link

It didn't for me either, alas - but there's a snippet on https://gravitywiz.com/documentation/gpnf_init_script_args/ that does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment