Support

Account

Home Forums General Issues Trying to get group field with get_post_meta inside function.php Reply To: Trying to get group field with get_post_meta inside function.php

  • I searched everywhere and nothing found about how to use get_post_meta for group type fields.
    After I did some tests found the follwing method:

    For example you have a field type group named : group_field_type
    Inside the ‘group_field_type’ you have two text type fields : inside_group_one and inside_group_two

    to get the two text fields inside the group with get_post_meta in php would be:

    
    $inside_group_one = get_post_meta( get_the_ID(), 'group_field_type_inside_group_one', true );
    $inside_group_two = get_post_meta( get_the_ID(), 'group_field_type_inside_group_two', true );
    
    echo $inside_group_one.'<br>';
    echo $inside_group_two.'<br>';
    

    You concatenate the group field name with the field name inside the group.

    Hope it helps.
    Best wishes