$args = array( 'post_type' => 'case_studies'); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); the_ID(); endwhile;