Home Forums Backend Issues (wp-admin) How can I get field_object without post?


How can I get field_object without post?

  • Hello!

    Can I get and use field_object without post?
    I am making a CSV updating function and correcting ACF fields.
    So there is no guarantee for existing a post.

    $field_keys = array('field_54af8ca08b1d9');
    foreach($field_keys as $field_key) {
      $object = get_field_object($field_key); // <= this raises a warning.

    Any ideas?

  • You can get all the fields in a field group if you know the group key.

    $fields = acf_get_fields('group_557b7c925ca6b')

    You can then loop through the fields (and recurse through sub fields) to find the field you’re looking for.

  • @hube2 Thank you for your reply.

    The project was ended, I will try your idea at next time.

    Thank you!

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

The topic ‘How can I get field_object without post?’ is closed to new replies.