Before you mark this as duplicate I have tried every method in all the other questions and non of them have worked.
I am trying to exclude any page with the page template page-noindex.php from the wp_list_pages(); query.
The below code does not work and when I echo out $the_query it just displays 'Array'.
<?php
$the_query = array(
'post_type' => 'page', /* overrides default 'post' */
'meta_key' => '_wp_page_template',
'meta_value' => 'page-templates/page-noindex.php'
);
$args = array(
'exclude' => $the_query,
'title_li' => '',
'sort_column' => 'menu_order, post_title',
'post_type' => 'page',
'post_status' => 'publish'
); ?>
<?php wp_list_pages($args) ?>
print_r($the_query)
instead.