Support

Account

Home Forums Add-ons Repeater Field Output comma separated list of repeater sub field values

Solved

Output comma separated list of repeater sub field values

  • I have an ACF repeater field field_5f71d4eaaf381 for email addresses and I want to output a comma separate list of the sub field values (measurement_extra_email_address) to create a $to for the WordPress mail function.

    
    			$values			  = $_POST['acf'];
    			$extra_recipients = $_POST['acf']['field_5f71d4eaaf381'];
    
    			if ( $extra_recipients ) {
    				$list = array();
    				foreach( $extra_recipients as $extra_recipient ) {
    					$list[] = $extra_recipient['measurement_extra_email_address'];
    				}
    				$to = implode(',', $list);
    			}
    

    I thought above code should/would do it but no email is being send so I guess the code is incorrect..?

    Just a note: When I remove above part of the code and just try $to = '[email protected]'; an email is being send so the error should be in there…

  • Here’s the code I was looking for:

    
    			$values	= $_POST['acf'];
    			$measurement_mail_extra_recipients = $_POST['acf']['field_5f71d4eaaf381'];
    
    			if ( $measurement_mail_extra_recipients ) {
    				$list = array();
    				foreach( $measurement_mail_extra_recipients as $measurement_mail_extra_recipient ) {
    					$list[] = $measurement_mail_extra_recipient['field_5f71d55aaf382', $measurement_client];
    				}
    				$to = implode(',', $list);
    			}
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.