Name and Select Dropdown
-
Hello,
I have added a Name Field and a Select Dropdown (Interest Group).
I have added the code for interest groups:
add_filter( 'mctb_data', function($data) { // make sure we have an array to work with if( ! isset( $data['INTERESTS'] ) ) { $data['INTERESTS'] = array(); } // replace "interest-id" with the actual ID of your interest. $data['INTERESTS'][] = "d467c984b7"; return $data; });
And also the hook for the Name field:
add_filter( 'mctb_data', function( $vars ) { $vars['FNAME'] = ( isset( $_POST['FNAME'] ) ) ? sanitize_text_field( $_POST['FNAME'] ) : ''; return $vars; });
The Name field comes through but the Group data doesn’t.
My whole code is this:
add_filter( 'mctb_data', function( $vars ) { $vars['FNAME'] = ( isset( $_POST['FNAME'] ) ) ? sanitize_text_field( $_POST['FNAME'] ) : ''; return $vars; }); add_filter( 'mctb_data', function($data) { // make sure we have an array to work with if( ! isset( $data['INTERESTS'] ) ) { $data['INTERESTS'] = array(); } // replace "interest-id" with the actual ID of your interest. $data['INTERESTS'][] = "d467c984b7"; return $data; });
I have tried to use 1 ‘mctb_data Hook and combine the 2 data but it doesn’t work.
Do you know what I’m doing wrong?
Many thanks for any help you can give me.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Name and Select Dropdown’ is closed to new replies.