Home › Forums › Front-end Issues › Limit relationship posts per page › Reply To: Limit relationship posts per page
So I want to do something similar to this and I understand the solution of returning the IDs and using a WP_Query to get only the ones I want. Obviously that creates an extra DB call, so my question is one of performance. Is it better to return the IDs and do the extra WP_Query or would it work to just use PHP to limit the array result after the fact with PHP? Maybe using array_slice
For example:
$posts = get_field('conference_talks');
$posts= array_slice($posts, 0, 5);
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.