Support

Account

Home Forums ACF PRO Prime Local JSON Cache?

Solved

Prime Local JSON Cache?

  • I’m using the Local JSON fields without any database references to the ACF fields. Currently on the Admin wp-list-tables page ( where it lists all the posts ) I’m using get_field() but it’s returning an empty/dummy field. I have a custom field attribute in my local JSON that I’d like to reference throughout. It works fine on the single post pages while in the form but outside it does not. I’m calling it inside the manage_{$post_type}_posts_custom_column hook like so:

    get_field( 'first_name', $post_id );

    So my question is, can I prime the Local JSON field cache via function / method call?

  • I think the core issue is when dealing with pure local json fields and calling get_field() by name will attempt to check postmeta for the field key. If you call get_field() using the field key, it pulls from local JSON just fine. The solution was looking through local fields for a match – not perfect but works in my usecase:

    https://support.advancedcustomfields.com/forums/topic/local-json-get_field-returns-only-using-key/#post-63051

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

You must be logged in to reply to this topic.