I've seen this solution for querying pages based off of template type: Page template query with WP_Query
I'm having trouble getting it to work with posts, that are using a "Single Post Template:" rather than a "Template Name:" definition.
Here is my code:
// query
$the_query = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'single-current.php'
)
)
));
Is there a different 'key' I should be using?
Something like '_wp_post_template'
Thanks.
_wp_page_template
gets stored unless you're explicitly changing it. Can you try a query where the template is NOTdefinition
?