Home Forums Front-end Issues How to get current ACF fields using by post ?


How to get current ACF fields using by post ?

  • I am using unlimited ACF fields for a post and I am getting all posts on the frontend using function get_field_objects. I have created ACF fields for the post A and later I change the rule and assign that fields to another post B but on front end get_field_objects still getting old fields data for post A.

    Is there a way that only display the fields based on rules for both free and pro plugin ?

  • Hi @sabbas

    I’m afraid get_fields_object() will show all the fields that exist in the database for the current post. It’s not based on the location rule.

    If you want, you can get the fields object by use the group ID like this:

    $fields = acf_get_fields(99);

    Where “99” is the group ID.

    I hope this helps 🙂

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

You must be logged in to reply to this topic.