Support

Account

Home Forums Backend Issues (wp-admin) Hooking into the custom field 'name'

Helping

Hooking into the custom field 'name'

  • Hello!

    Wonderful plugin I’ve heard nothing but good things about if from my partner and have been challenged with the task of supporting it from our Landing Pages plugin through an extension.

    So far this has been one of the best developer friendly plugins I’ve worked with and have made great progress with development, but there is one spot I’m stopped at.

    When rendering custom field metaboxes on the admin side I need to be able to account for the current page variation loaded in a landing page cpt post.

    Variations are set with a url param id and I can grab that id when rendering the fields; but what I need to be able to do now is slightly alter the field id names so that if we have a custom field with id authorbio, it would become authorbio-1 on the first variation and authorbio-2 on the second variation.

    I see where acf_render_field() is used to render a field, and I see the filter ‘acf/get_fields’ allows me to modify field values. But I still need help tying it all together.

    Forms are rendered with input names like: acf[field_53e2a615d1c24] (which seems to map to a hidden meta key that looks like _authorbio and there is another meta key authorbio that has the saved value.

    At the end of the day I need to have a meta key that’s like authorbio-1 and another meta key like authorbio-2.

    When I call these values out on the front end I will have the variation id ready, so I would need to hook into the get_field(‘authorbio’) method and tell it to pull the right variation.

    At this point I’m looking for a hand hold.

    Can anyone help me?

  • Here is a another summary if the first writeup is difficult to understand:

    Basically what I need is a way to change the name input of a custom field depending on the post that is being edited.

    So if we are editing a post that has a URL like this:
    http://inboundsoon.dev/wp-admin/post.php?post=95897&action=edit&variation=2

    Then I need to modify the ACF saved name input to have -2 on the end of it.

    And when the same page loads it needs to detect that it needs to populate custom field values from the values stored with -2 in the name key.

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

The topic ‘Hooking into the custom field 'name'’ is closed to new replies.