GravityKit / GravityView

The best and easiest way to display Gravity Forms entries on your website.
https://www.gravitykit.com/products/gravityview/
245 stars 62 forks source link

Fix recursion in ACF fields with GravityView shortcodes #1998

Closed doekenorg closed 4 months ago

doekenorg commented 4 months ago

This PR adresses #1812.

It looks like a recursion is going on when trying to retrieve the meta fields for a post. It used the get_field_objects() method of ACF. Apparently they are right when they say:

The function is not very elegant and wastes a lot of PHP memory / SQL queries if you are not using all the fields / values

So I've replaced it with half the internal method, retrieving the meta keys for ACF only, and microcaching the result.

This fixes the recursion for me, and I'm able to show the view when rendering the_field('content');.