corcel / acf

Advanced Custom Fields (ACF) plugin for Corcel
127 stars 100 forks source link

Relations for fields #37

Open antonzapevalov opened 7 years ago

antonzapevalov commented 7 years ago

I want show list of posts. I am get 10 posts per page. In template for every post i am get acf image. For 10 posts 40 SQL requests are executed. How to set up a normal relations for fields, to run only one query?

jgrossi commented 7 years ago

Hi @ZapevalovAnton actually that's currently not possible due to how ACF stores data into the WP database. You have to make multiples queries to fetch the custom field type, then others to get the post object and then the content. One of the big improvements to be made into corcel/acf is the performance.

If you take a look on ACF plugin itself we have a lot of queries. Maybe you can work in a PR to reduce the number of queries, creating some complex queries to avoid duplicated one. What do you think?