sanitize meta input
You need to escape data while displaying also. Use esc_attr in your case. Try this: <input type=”text” name=”field_name” value=”<?php echo (!empty($field)) ? esc_attr( $field ) : ”; ?>” /> Check this for full documentation – https://codex.wordpress.org/Data_Validation