Support

Account

Home Forums ACF PRO (Filter) update_value for Group field

Solving

(Filter) update_value for Group field

    • cannap

    • March 24, 2018 at 12:06 am

    Hi i have a group field
    with
    seo
    – title
    – description field

    my goal is when i not fill the title or description field in seo i want to fill it from the post title and excerpt

    add_filter('acf/update_value/name=seo', 'renka_fill_empty_seo_fields', 10, 3);
    
     function renka_fill_empty_seo_fields($value, $post_id, $field)
     {
         // $value is still empty
         var_dump($field);
     }
    

    but i have no idea how i can set the value for the group i know how i can do it when i use 2 filters and use the field names direct

  • I’m running into the same issue. There’s no clear indication of this behaviour in the documentation or on these forums / StackOverflow.

  • A group field operates on the same principle as a repeater field. It is a repeater field that always has 1 row. I have not tried it but I would assume that update_sub_field() is what you’re looking for https://www.advancedcustomfields.com/resources/update_sub_field/

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.