Home Forums ACF PRO get_fields vs multiple get_field Reply To: get_fields vs multiple get_field

  • For me it would depend on what I was returning in the AJAX call. If I was returning a JSON object then I would probably use get_fields() because I’d be doing all of the formatting of the data using JavaScript after the response was returned. If I was returning HTML then I’d go back to my original comment.

    If you’re worried about how many DB calls are made for the requests then you could do both, forcing ACF to get all the fields and then getting each one separately. Once the fields are loaded once they values are stored in the WP cache so later calls to get the same field will not generate another DB call.