Skip to content

Commit aa3ba6f

Browse files
committed
Remove _wplf_email_copy_to meta if input is empty
1 parent 7e6d244 commit aa3ba6f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

classes/class-cpt-wplf-form.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,11 @@ function save_cpt( $post_id ) {
402402
$to = sanitize_email( $emailField );
403403
}
404404

405-
update_post_meta( $post_id, '_wplf_email_copy_to', $to );
405+
if( !empty( $to ) ) {
406+
update_post_meta( $post_id, '_wplf_email_copy_to', $to );
407+
} else {
408+
delete_post_meta( $post_id, '_wplf_email_copy_to' );
409+
}
406410
}
407411

408412
// save title format

0 commit comments

Comments
 (0)