Home › Forums › Front-end Issues › Limit relationship posts per page › Reply To: Limit relationship posts per page
I guess it depends on what order you want the posts returned in and what 5 you want to limit it to. By default, I believe, that the order that they’re returned when getting the field is the order that they are in relationship field, although I could be wrong. I just had a look and there isn’t any way to alter the order then getting the field.
If you return an array of ID values, no query of posts is done before they are returned when using get_field(), so there isn’t any double query happening if you’re not returning post objects.
You are right though if you return post object and do a second query then you’re basically doing 2 queries to get almost the same thing. This is where it’s important to consider and select what is returned when setting up ACF fields for what you intend to do with it later.
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.