get\\u posts(\'numberposts=5&category=93+85\')get\\u posts(\'numberposts=5&category=9385\'))
有没有办法让get\\u帖子只抓取两个类别中的帖子,如上所述?
get\\u posts(\'numberposts=5&category=93+85\')get\\u posts(\'numberposts=5&category=9385\'))
有没有办法让get\\u帖子只抓取两个类别中的帖子,如上所述?
Use WP_Query
\'s category__and
:
$args = array(
\'posts_per_page\' => 5,
\'category__and\' => array( 93, 85 )
);
$my_query = new WP_Query( $args );
while( $my_query->have_posts() ):
$my_query->the_post();
the_title();
endwhile;
wp_reset_postdata();