我需要得到term 运行WP查询时的每个帖子。我在圈里试过这个
$term = $loop->get_queried_object();
echo $term->name;
但我仍然得到自定义的帖子类型注册名,而不是得到术语!
$args = array(
\'post_type\' => \'services\',
\'post_status\' => \'publish\',
\'posts_per_page\' => 8,
\'orderby\' => \'title\',
\'order\' => \'ASC\',
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
$term = $loop->get_queried_object();
echo $term->name;
echo get_the_title();
endwhile;
wp_reset_postdata();