Detecting empty merge fields
-
I come back to a function discussed earlier:
add_filter( 'yikes-mailchimp-filter-before-submission', 'maybe_supply_FNAME_to_merge_field', 10, 1 ); function maybe_supply_FNAME_to_merge_field( $merge_fields ) { if ( empty( trim( $merge_fields['SALUTATION'] ) ) && ! empty( $merge_fields['FNAME'] ) ) { $merge_fields['SALUTATION'] = $merge_fields['FNAME']; } return $merge_fields; }
It turns out that the expression
empty( trim( $merge_fields['SALUTATION'] ) )
always returns TRUE, whether the subscriber has entered a value in the SALUTATION field of the form or not.
I have confirmed that the merge field SALUTATION is correctly set in the Yikes form
I have also tried the expression:
!isset( $merge_fields['SALUTATION'] )
with the same result.So how to fix that?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Detecting empty merge fields’ is closed to new replies.