Wordpress - Getting the IDs of a custom post type
You can get a simple array of CPT IDs by using get_posts
with the fields
parameter.
$all_post_ids = get_posts(array(
'fields' => 'ids',
'posts_per_page' => -1,
'post_type' => 'case_studies'
));
Found the basis of the answer buried in the codex
$args = array( 'post_type' => 'case_studies');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
the_ID();
endwhile;