私はとても近づいていますが、間違いがあります。 私はWP wooCommerceのインストールに3つのカスタムフィールドを追加しました。フックとテンプレートを使って、登録とアカウントのページに追加しました。自分のプロフィールエリア/フロントエンドからユーザーとして正常に更新できます。 私が悩んでいるのは、編集ユーザー管理フォームでこれらのフィールドを更新していることです。フィールドを表示することはできますが、更新するだけではありません。WPユーザーのカスタムフィールドの更新を編集
考えと助けを探しています。私は何が欠けていますか?前もって感謝します。
これは私の子テーマのfunctions.phpで私のコードです - ADMIN編集USER
function sbb_custom_user_profile_fields($user) {
?>
<legend><h4>Reseller Info</h4></legend>
<table class="form-table">
<tr>
<th>
<label for="ssb_reseller_tax_id"><?php _e('Resseller Tax ID'); ?></label>
</th>
<td>
<input type="text" name="sbb_reseller_tax_id" id="sbb_reseller_tax_id"
value="<?php echo esc_attr(get_the_author_meta('reseller_tax_id', $user->ID
)); ?>" class="regular-text" />
</td>
</tr>
<tr>
<th>
<label for="sbb_title"><?php _e('Title'); ?></label>
</th>
<td>
<input type="text" name="sbb_title" id="sbb_title" value="<?php echo esc_attr(get_the_author_meta('title', $user->ID)); ?>" class="regular-text" />
</td>
</tr>
<tr>
<th>
<label for="sbb_fax"><?php _e('Fax'); ?></label>
</th>
<td>
<input type="text" name="sbb_fax" id="sbb_fax" value="<?php echo esc_attr(get_the_author_meta('fax', $user->ID)); ?>" class="regular-text" />
</td>
</tr>
</table>
<?php
update_user_meta(get_the_author_meta($user->ID), 'reseller_tax_id', htmlentities($_POST[ 'reseller_tax_id' ]));
update_user_meta(get_the_author_meta($user->ID), 'fax', htmlentities($_POST[ 'fax' ]));
update_user_meta(get_the_author_meta($user->ID), 'title', htmlentities($_POST[ 'title' ]));
}
add_action('show_user_profile', 'sbb_custom_user_profile_fields');
add_action('edit_user_profile', 'sbb_custom_user_profile_fields');
add_action('edit_user_profile_update', 'sbb_custom_user_profile_fields');
ありがとうNathan - 私はそれを行ってあなたに知らせる – SIouxsie