Support

Account

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 🙂