Support

Account

Home Forums Front-end Issues acf_form() fields option

Solving

acf_form() fields option

  • Hi,
    I try to show on frontent a form, based on a ACF fields group, but I want to show only two fields of this group.
    This is my code:

    <?php
    acf_form(array(
    	'post_id' => 'new_post',
    	'field_groups' => array('31'),
    	'fields' => array('field_55fbd2ec6359f', 'field_560e37f2d8763'),
    	'post_title' => true,
    	'post_content' => true,
    	'new_post' => array(
    		'post_type' => 'my_custom_post_type_name',
    		'post_status' => 'publish'
    	)
    ));
    ?>

    The problem is that this code always show all gropup fields and not only the two specified. Why?

    Thanks

  • Anyone can help me? acf_form() function works only with ACF Pro?

  • I tried again to use acf_form() function but I didn’t solve my problem described above.
    I need a support about this.
    Thanks

  • Looking at your original code, to include just the fields elimiating the field_groups option should do what you want

    
    <?php
    acf_form(array(
    	'post_id' => 'new_post',
    	'fields' => array('field_55fbd2ec6359f', 'field_560e37f2d8763'),
    	'post_title' => true,
    	'post_content' => true,
    	'new_post' => array(
    		'post_type' => 'my_custom_post_type_name',
    		'post_status' => 'publish'
    	)
    ));
    ?>
    
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘acf_form() fields option’ is closed to new replies.