Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Created April 30, 2024 13:53
Show Gist options
  • Save Crocoblock/4ebf5950e34edc7704259755687ada17 to your computer and use it in GitHub Desktop.
Save Crocoblock/4ebf5950e34edc7704259755687ada17 to your computer and use it in GitHub Desktop.
JetFormBuilder Update post via Call Hook action
<?php
add_action( 'jet-form-builder/custom-action/update-current-post', function ( $request, $handler ) {
$post_id = $request['post_id'] ?? 0;
if ( ! $post_id ) {
return;
}
$rooms_new_number = $request['_form_field_1'] ?? null;
if ( ! isset( $rooms_new_number ) ) {
return;
}
update_post_meta( $post_id, "_rooms", $rooms_new_number );
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment