NJT
NJT

Reputation: 334

Advanced custom fields relationship object returning only 5 posts

I've got two custom post types, Type A and Type B. Type A can be associated with any number of Type B posts. I use the relationship object from the Advanced Custom Fields plugin to associate Type B posts to Type A. I'm able to pull out the list of Type B posts related to Type A on the archive page for Type A but I noticed that only 5 related posts get shown at a time. If I remove one, the next one shows up but the total number of related posts is still 5.

Has anyone else faced this issue?

Upvotes: 0

Views: 137

Answers (1)

NJT
NJT

Reputation: 334

Turns out the issue wasn't with Advanced Custom Fields but with get_posts query that I had used. I missed the fact that as default, get_posts shows only 5 posts. Fixed it by adding

'numberposts'=> -1

Upvotes: 2

Related Questions