Skip to content

Commit 0ca3212

Browse files
author
Antti Kuosmanen
authored
Merge pull request #29 from timiwahalahti/issue-25
Remove _wplf_email_copy_to meta if input is empty
2 parents 7e6d244 + 506a1e3 commit 0ca3212

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

classes/class-cpt-wplf-form.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ function meta_box_title_format( $post ) {
332332
?>
333333
<p><?php _e('Submissions from this form will use this formatting in their title.', 'wp-libre-form'); ?></p>
334334
<p><?php _e('You may use any field values enclosed in "%" markers.', 'wp-libre-form');?></p>
335-
<p><input type="text" name="wplf_title_format" value="<?php echo esc_attr( $format ); ?>" placeholder="<?php echo esc_attr( $default ); ?>" class="code" style="width:100%"></p>
335+
<p><input type="text" name="wplf_title_format" value="<?php echo esc_attr( $format ); ?>" placeholder="<?php echo esc_attr( $default ); ?>" class="code" style="width:100%" autocomplete="off"></p>
336336
<?php
337337
}
338338

@@ -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)