Modified Hooks issue
-
HI,
I use the following code on my site, and it now comes up with an error when the form is submitted (selected value does not exist). I think it may be because the forminator_replace_form_data hook has been modified. Please could you let me know how to change the code so it continues to work.
Here’s the code:
'forminator_replace_form_data', function( $content, $data, $fields ) { if ( ! empty( $content ) ) { return $content; } $form_fields = Forminator_API::get_form_fields( $data['form_id'] ); $data_field = ''; foreach($data as $key => $value){ if ( strpos( $key, 'select' ) !== false ) { $values = ''; $field_value = isset( $data[ $key ] ) ? $data[ $key ] : null; if ( ! is_null( $field_value ) ) { $fields_slugs = wp_list_pluck( $form_fields, 'slug' ); $field_key = array_search( $key, $fields_slugs, true ); $field_options = false !== $field_key && ! empty( $form_fields[ $field_key ]->raw['options'] ) ? wp_list_pluck( $form_fields[ $field_key ]->options, 'label', 'value' ) : array(); if ( ! isset( $field_options[ $field_value ] ) && isset( $_POST[ $key ] ) ) { return sanitize_text_field( $_POST[ $key ] ); } } } } return $content; }, 10, 3 );
thank you
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Modified Hooks issue’ is closed to new replies.