File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -384,7 +384,25 @@ function save_cpt( $post_id ) {
384384
385385 // save email copy
386386 if ( isset ( $ _POST ['wplf_email_copy_to ' ] ) ) {
387- update_post_meta ( $ post_id , '_wplf_email_copy_to ' , sanitize_email ( $ _POST ['wplf_email_copy_to ' ] ) );
387+ $ emailField = $ _POST ['wplf_email_copy_to ' ];
388+ $ to = '' ;
389+
390+ if ( strpos ( $ emailField , ", " ) > 0 ) {
391+ // Intentional. Makes no sense if the first character is a comma, so pass it along as a single address.
392+ // sanitize_email() should take care of the rest.
393+ $ emailArray = explode ( ", " , $ emailField );
394+ foreach ($ emailArray as $ email ){
395+ $ email = trim ($ email );
396+ $ email = sanitize_email ( $ email ) . ", " ;
397+ $ to .= $ email ;
398+ }
399+ $ to = rtrim ( $ to , ", " );
400+ }
401+ else {
402+ $ to = sanitize_email ( $ emailField );
403+ }
404+
405+ update_post_meta ( $ post_id , '_wplf_email_copy_to ' , $ to );
388406 }
389407
390408 // save title format
You can’t perform that action at this time.
0 commit comments