Skip to content

Instantly share code, notes, and snippets.

@leepettijohn
Created December 20, 2016 19:19
Show Gist options
  • Save leepettijohn/0ad94f877a87e2dec4b51222fbc29443 to your computer and use it in GitHub Desktop.
Save leepettijohn/0ad94f877a87e2dec4b51222fbc29443 to your computer and use it in GitHub Desktop.
Update Custom Field after Gravity Form Submission
<?php /* *** Change form id on next line *** */
add_action( 'gform_after_submission_10', 'update_wdi_approved', 10, 2 );
function update_wdi_approved( $entry, $form ) {
/* *** Get the field result *** */
$get_title = rgar($entry,'1');
$get_wdi_date = rgar($entry,'2');
/* *** Get the custom post type 'clip_order' id *** */
$orderid = get_page_by_title($get_title,'OBJECT','clip_order');
/* *** Update the custom field in that post *** */
update_post_meta($orderid->ID,'wdi_approval_date',$get_wdi_date);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment