I am trying to pull out all post ID's that have the same post title. This is in a custom post type called 'course-manager'. Here is what I have so far:
$pages = array();
$args1 = array(
'post_type' => 'course-manager',
'posts_per_page' => -1,
);
query_posts( $args1 );
$page = get_page_by_title( $current_post_title, 'OBJECT', 'course-manager' );
while ( have_posts() ) : the_post(); //query all pages and get id's of pages with the specific title. Put id's in an array and use array in query below to query each id
$pages[] = $page->ID;
echo $page->ID;
endwhile;
wp_reset_postdata();
This should work in my opinion. I have four posts - two with the title I am searching for and 2 with a different title... however instead of getting the two differnt post ID's I want, I am getting 4 post ID's all the same. :/
Thanks