Home › Forums › General Issues › Display a list of media in custom post type › Reply To: Display a list of media in custom post type
Hi @sireagroup
I believe that’s because you have an option on your site that allows only five posts. In this case, you need to use the posts_per_page
option like this:
$doctors = get_posts(array(
'post_type' => 'doctor',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'location', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
)
));
Hope this helps 🙂
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.