Home Forums Feature Requests load_field : add more data, to make it more flexible programmatically


load_field : add more data, to make it more flexible programmatically

  • Hi

    Could please consider adding some more data/variables to the load_field filter?
    – The data of higher fields in hierarchy in case of nested fields
    – Previous fields that were loaded for the current row (if there is any)

    It will allow to be more dynamic with field loading. For example, loading a select box values according to a selected post.

    Perhaps this could be programmed somehow, via a filter. And/or, limited in functionality to prevent high memory usage. Anyway, it can be tweaked on and off for specific groups, for those who need it.

    I know one can achieve that with ajax, but that’s a lot more round trips to the server and will probably require more code too.

    What do you think?


  • Before I start, I am not a developer of ACF, just another user that knows a lot about how it works. If you want an official reply from the developers you should submit a support ticket here

    Most of what your looking for is not really possible in ACF. Fields are not really aware of other fields. Sub fields are only minimally aware of their parent field. Field so not have any data the will allow them to know what other fields are siblings. In order to do this large amounts of data and arguments would need to be used in all function calls, which would seriously over-complicate the code and as you suspect, possibly cause memory issues.

    However, there are built in functions that will let you get this information if you really want it for a specific field. Most of these functions are not documented on the site because they are not things that the average user will ever need.

    For example, the field does have a reference to it’s parent in $field['parent'] which you could use to get information about the parent field. I believe there is also a function somewhere in ACF that will get the parent field info, but at don’t know exactly what it is. Using the information about the parent you can then probably get it’s sub fields. These methods are the same ones used by ACF to do this kind of thing. All the information is there and you need to use the right functions to get it. Unfortunately, the only real way to get this information is to start digging through ACF code and seeing what it does.

  • Thx

    If I’m not mistaken, the parent field provides the field information without the loaded value, but I’ll check

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

The topic ‘load_field : add more data, to make it more flexible programmatically’ is closed to new replies.