Home Forums Front-end Issues Use acf_form to build a form to edit particularly fields only


Use acf_form to build a form to edit particularly fields only

  • I’d like to use acf_form to build a front-end form that only allows particular fields to be editing in the frontend. I can isolate by field_group as expected, but I’m not clear how to make use of the ‘fields’ parameter which is how I imagine you would control which individual fields you want to display.

    I’ve looked in my database, and I see key values for individual values that have been added for various fields, but I’m not seeing a field key tied to the field itself, which is presumably what would be used to create a form that would allow for any post to be edited using the form. Any help as to where I can find these values is appreciated, thanks!

  • You are correct. In this example I’m only allowing one field of a particular field group to be modified:

    $options = array(
      'field_groups' => array('group_55788c04bcfd8'),
      'fields' => array('field_55788c13e6bf0'),

    Getting the group key and field keys is easy and generally overlooked by a lot of people. Click on screen options. To see the group key show the post slug. Showing the field keys is a radio button.

  • Excellent, there they are and they work as I had hoped. Thanks!

    Is it possible to only show the post title field?

  • If you mean the standard WP post title field. What you need to do is create another field for people to enter the title and then convert that into a title in an acf_pre_save_post filter. There is an example of doing this in this question and you can read more about it here

  • I was looking for that solution and it worked like a charm, thanks again Huebner.

    And I have a question about it,

    I want to edit the same post on the same page but different parts of it in different navigation tabs.

    So I added 2 acf_form element on the same page with different $options.
    I am getting [DOM] warning that “Found 2 elements with non-unique id”

    Code still works well, but I wonder would that warning be a problem?

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Use acf_form to build a form to edit particularly fields only’ is closed to new replies.