Get page IDs based on which template they are using?

WP_Query goes only through posts by default.

Try adding page as your post type:

$the_query = new WP_Query(array(
    'post_type'  => 'page',  /* overrides default 'post' */
    'meta_key'   => '_wp_page_template',
    'meta_value' => 'templates/_partner.php'
));

See: WP_Query – Type Parameters

Leave a Comment