为什么此代码无法检索自定义帖子类型“graphic design”的帖子?
<?php
$args = array( \'pagename\' => \'graphic-design\' );
$query = new WP_Query($args);
while ( $query->have_posts() ) : $query->the_post();
?>
<div id="graphic-design" class="active page clearfix">
<h3 class="subtitle"><?php the_title(); ?></h3>
<?php
$inner_args = array( \'post_type\' => \'graphic-design\' );
$inner_query = new WP_Query( $inner_args );
while ( $inner_query->have_posts() ) : $inner_query->the_post();
?>
<div class="work">
<?php the_post_thumbnail(); ?>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
当我单独运行内部查询时,外部查询之外的查询工作正常。