Hi James
Thanks for your swift reply – very much appreciated.
Unfortunately I had tried $args[‘posts_per_page’] = 1
already with no noticeable difference between that or, say 3 posts, or 10.
But, having a hit a brick wall it caused me to investigate a few other things and I hit upon the answer…
I realized that for these relationship fields (and it could be up to 4 fields, depending on the layout the user had chosen for the page) I had selected in the “filter” option for the field “search”, “post type” AND “taxonomy” and it crossed my mind that these 12,000 posts would have quite a few terms added – 30,000 in fact! So by turning off the taxonomy filter my problem has been all but eradicated.
There is effectively no performance hit for having 12,000 posts it was the taxonomy filter causing the bottleneck.
Thanks for your help and in this case just making me look harder myself. Hopefully could be useful information for someone else.
Thanks James & Rafaella for this discussion…
I also have this problem…
I require the user to pick posts from a selection of 12,000 posts
And also, this relationship field is part of a “layout” field – so, feasibly a page can have 3 relationship fields, each selecting from these 12000 posts.
As you can imagine the page load time is slow – 30s+ when I have the field group enabled and 3s when it is disabled.
Obviously I am my own worst enemy here we’re such requirements! but I’d really love to find a way to use the relationship fields on such a big site. Or I will have to resort to the user picking post IDs manually…
Can anyone think of a different way to do this or a filter that could improve the relationship field further?
I tried
$args[‘posts_per_page’] = 0;
Which did reduce the number of posts on view in each relationship field but hardly affected the page load time.
Many thanks for any input
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.