0
所以我已经变得如此接近,但这里必定会有一个错误。 我在做什么是我已经将3个自定义字段添加到WP wooCommerce安装。我已经通过hook和woo模板添加到注册和我的帐户页面。我可以成功地从他们的个人资料区域/前端罚款更新为用户。 我被困在的是编辑用户管理表单更新这些字段。我可以让字段显示,但他们只是没有更新。WP编辑用户自定义字段更新
寻找想法和帮助。我错过了什么?提前致谢。
这是我在我的子主题的functions.php代码 - ADMIN编辑用户
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