So I have a very basic form which allows users to edit their profile data:
<?php
$current_user = wp_get_current_user();
?>
<div class="rh_contact_form">
<?php echo '<input type="text" id="rhc_phone" name="rhc_phone" placeholder="Phone number" value="' .$current_user -> billing_phone. '"/>' ;?>
<?php echo '<input type="text" id="rhc_question" name="rhc_question" placeholder="My question" value="' .$current_user -> my_question. '"/>' ;?>
<div class="rh_button">
<button type="button">
<i class="icons">done</i>
</button>
</div>
</div>
Now, how do I implement wp_update_user
in this case to update the user meta only if value is different from the current value or if it is not empty (for example, if they delete the current value in the input field, then it does not get rid of the meta).
Any help will be much appreciated.