Hi there, I am trying to add custom fields from a form to a front end page in WC Vendors.
Ive managed to display the form in the users/vendors front end profile, the blank fields are also displaying in the user profile in the back end , however I cant get any of the data I type in the front end to show in the back end.
Any ideas what I am doing wrong?
add_action(‘wcvendors_settings_after_shop_name’, ‘wcv_save_acf_fields’);
function wcv_save_acf_fields() {
acf_form_head();
}
add_action(‘wcvendors_settings_after_seller_info’, ‘wcv_add_acf_fields’);
function wcv_add_acf_fields() {
acf_form( array(
‘post_id’ => ‘user_’.$current_user->ID, // $user_profile,
‘field_groups’ => array(5720),
‘form’ => true,
‘return’ => false,
‘submit_value’ => ‘Update’
) );
}
Hi @derekk2110
Please keep in mind that you need to place acf_form_head()
function on top of your template. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/create-a-front-end-form/.
Also, could you please make sure that the $current_user
variable has the right data? I believe you need to get it from the global variable first like this:
global $current_user;
acf_form( array(
'post_id' => 'user_'.$current_user->ID,
Thanks 🙂