Support

Account

Home Forums Backend Issues (wp-admin) Edit custom fields w/o using Location Rules

Solved

Edit custom fields w/o using Location Rules

  • I’m using acf_form to allow users to create a new custom post type on the front end called an “application”. Any given application can have 1 or more custom field groups. So the field groups associated with any given application can vary. This I have working.

    An admin needs to be able to edit the data that the user has submitted.

    How can I have the relevant field groups appear in the edit screen for a specific application post (i.e. at wp-admin/post.php?post=123&action=edit)

    (i’m not explicitly associating these field groups with my CPT using Location Rules)

    hope this question makes sense!

  • Hi @locomo

    I don’t have an exact answer for you on this one.

    Your question is:
    How can I have the relevant field groups appear in the edit screen for a specific application post (i.e. at wp-admin/post.php?post=123&action=edit)

    The answer is to use location rules. The location rules are there to find which field groups to render. Can you provide some more infor about your needs?

    Are you suggesting that you want to pass a $_GET param which then determines the field groups to be shown in acf_form?

    Thanks
    E

  • in my scenario individual posts of a CPT may have different field groups associated with them

    is there a way to render a field group in the edit screen for a CPT without using location rules?

    i’m thinking i would hook into the “add_meta_box” action .. and i know the ID of the field group i want .. i’m just not sure how to use the ACF API to render the field group

  • Hi @locomo

    Thanks for clarifying. In short, yes.

    Just checkout the core/controllers/post.php file and you will all the code to render a field group.

    The current api is all filter based, but in v5, there will be an array of powerful functions instead which will be much nicer to use.

    Thanks
    E

  • i can’t find that file .. is that in the current stable version?

  • Hi @locomo

    It might be only in the new 4.3:
    https://github.com/elliotcondon/acf

    But in 4.2.2, you can find the code in the input.php controller instead.

    Thanks
    E

  • great thanks .. i was able to solve this by hooking “acf/location/match_field_groups” to set the $metabox_ids that i want to render

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

The topic ‘Edit custom fields w/o using Location Rules’ is closed to new replies.