小编Ami*_*ohi的帖子

在我的帐户中添加个人资料图片(文件上传)> 在 WooCommerce 中编辑帐户

我想添加上传个人资料图像字段并将其保存在“我的帐户”>“编辑帐户”中,无需在 woocommerce 中使用任何插件。

我添加了以下代码functions.php以在我的帐户页面上添加个人资料图片。

add_action( 'woocommerce_edit_account_form', 'add_profile_imageto_edit_account_form' );
function add_profile_imageto_edit_account_form() {
    $user = wp_get_current_user();
    ?>
    <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
        <label for="favorite_color"><?php _e( 'Upload Profile Photo', 'woocommerce' ); ?>  </label>
        <input type="file" name="profile_image" id="profile_image" placeholder="Upload Profile Photo" />
    </p>
    <?php
}
Run Code Online (Sandbox Code Playgroud)

建议我任何人如何保存此数据并在编辑帐户页面中显示保存的数据。

php wordpress file-upload woocommerce hook-woocommerce

3
推荐指数
1
解决办法
8048
查看次数