Advanced Custom Fields
Display custom field group in front-end (1 post)

  1. wzshop
    Posted 2 years ago #

    I was wondering how i can hook/display a custom field group into my front-end form.
    I found this article: http://www.advancedcustomfields.com/resources/tutorials/creating-a-front-end-form/

    This made me to try this:

    add_action( 'product_custom'  , 'productfields'  );
    function productfields() {
    	$options = array(
    	'post_id'  => $post->ID, // post id to get field groups from and save data to
    	'field_groups'  => array('post'  => '88' ), // this is the ID of the field group
    	'form_attributes'  => array( // attributes will be added to the form element
    		'class'  => ''
    	'return'  => add_query_arg( 'updated' , 'true' , get_permalink() ), // return url
    	'html_field_open'  => '<div class="field">' , // field wrapper open
    	'html_field_close'  => '</div>' , // field wrapper close
    	'html_before_fields'  => '' , // html inside form before fields
    	'html_after_fields'  => '' , // html inside form after fields
    	'submit_value'  => 'Updates' , // value for submit field
    	'updated_message'  => 'Post updated.' , // default updated message. Can be false to show no message
    	acf_form( $options );

    This displays the field group + an update button, within a front-end form created with a thirdparty plugin. However i only want to display the custom fields group within the form. Furthermore atm it does not store the data of the custom field.

    So my question; how can i extend my previously made form with a custom field group made by the advanced custom fields plugin.

    Thank you so much in advance!


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic