WordPress
1
Вклад в тег
<p class="form-row form-row-wide">
<label for="phone">Телефон</label>
<input type="text" class="input-text" name="phone" id="phone" value="<?php echo esc_attr( $user->phone ); ?>" />
</p>
$tag = 'woocommerce_save_account_details';
$function_to_add = 'my_save_account';
$priority = 10;
$accepted_args = 1;
add_action( $tag, $function_to_add, $priority, $accepted_args );
function my_save_account($user_id) {
$phone = ! empty( $_POST[ 'phone' ] ) ? $_POST[ 'phone' ] : '';
update_user_meta($user_id, 'phone', $phone);
}