Php 在WordPress中按多个类别筛选

Php 在WordPress中按多个类别筛选,php,wordpress,filter,Php,Wordpress,Filter,我只想显示属于33类、39类和业余运动员的帖子。 我当前的代码显示33类和39类的帖子以及运动员: <?php query_posts( 'cat=33&cat=39&post_type=athletes'); ?> 我需要做哪些调整?您可以使用选项数组而不是查询字符串,在查询字符串中,您可以使用类别和设置来执行您想要的操作: <?php query_posts(array( 'category__and' => array(33,39),

我只想显示属于33类、39类和业余运动员的帖子。 我当前的代码显示33类和39类的帖子以及运动员:

<?php query_posts( 'cat=33&cat=39&post_type=athletes'); ?>


我需要做哪些调整?

您可以使用选项数组而不是查询字符串,在查询字符串中,您可以使用
类别和
设置来执行您想要的操作:

<?php
query_posts(array(
    'category__and'  => array(33,39),
    'post_type'      => 'athletes'
));
?>