0

I have to sanitize the following

<input type="date" id="periodo_1da" name="periodo_1da" class="list_prezzi" ><?php echo esc_attr( get_the_author_meta( 'periodo_1da', $user->ID ) ); ?>

I tryed with

update_user_meta( $user_id, 'prezzi_1da', sanitize_meta( $_POST['prezzi_1da'] ) );

but also with sanitize_text_field and sanitize_textarea, nothing works, which is the correct method?

1 Answer 1

0

I assume you're missing the value="", it seems like you use <input> as a regular HTML tag, and not a self-closing one.

A basic example of what it should be like if I only use your value and ignore all the other attributes.

<input value="<?php echo esc_attr( get_the_author_meta( 'periodo_1da', $user->ID ) ); ?>">

And here is the input tag with all the attributes and the correct value attribute.

<input type="date" id="periodo_1da" name="periodo_1da" class="list_prezzi" value="<?php echo esc_attr( get_the_author_meta( 'periodo_1da', $user->ID ) ); ?>">

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .