在您将此标记为重复之前,我已经在所有其他问题中尝试了所有方法,但没有一个有效。
我正在尝试排除任何带有页面模板page noindex的页面。来自wp\\u list\\u pages()的php;查询
下面的代码不起作用,当我回显$The\\u查询时,它只显示“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) ?>