robleigh
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Hello, I am doing well thank you hope you are also.
this is my function here which seems to have worked for many many months and then when updating to the latest version it stopped I was using ajax but also tried page reload and the values are in form on the front end perfectly fine and they get passed in the form data but not saved which I now find odd.add_filter('forminator_field_hidden_field_value', 'populate_custom_form_fields_forminator', 99, 4);
function populate_custom_form_fields_forminator( $value, $saved_value, $field, $hidden_field) {
if ( 'hidden-1' === $field[ 'element_id' ] ) {
$post_id = get_queried_object_id();
$seller = wp_get_post_terms( $post_id, 'seller' );
$seller_email = ( ! empty( $seller ) && get_field( 'seller_email', $seller[0] ) )
? get_field( 'seller_email', $seller[0] )
: '';
$value = $seller_email;
}
if ( 'hidden-3' === $field[ 'element_id' ] ) {
$post_id = get_queried_object_id();
$auction_id = get_field( 'auction_id', $post_id );
$value = $auction_id ?: '';
}
return $value;
};
Viewing 1 replies (of 1 total)