그래서 가까이 왔지만 여기에 실수가 있어야합니다. WP wooCommerce 설치에 3 개의 사용자 정의 필드를 추가했습니다. 등록 및 내 계정 페이지에 후크 및 우 템플릿을 통해 추가했습니다. 프로필 영역/프런트 엔드에서 사용자를 성공적으로 업데이트 할 수 있습니다. 내가 갇힌 것은 편집 사용자 관리 양식에서이 필드를 업데이트하는 것입니다. 나는 필드를 표시 할 수 있지만 그들은 단지 업데이 트되지 않습니다.WP 사용자 정의 필드 업데이트 편집
생각과 도움을 찾고 있습니다. 내가 뭘 놓치고 있니? 미리 감사드립니다. 관리 사용자 편집
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