New answers tagged sanitization
wp_filter_nohtml_kses() doesn't appear to work properly because it escapes the " character, so you can't write any attribute selectors. It seems like there is no "simple" way to do this.
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
Top 50 recent answers are included