Escludere una categoria da get_posts?
9 set 2011, 13:35:30
Visualizzazioni: 27.2K
Voti: 7
Ottengo i post per categoria con get_posts ma ho bisogno di escludere un'altra categoria chiamata london o id 10. È possibile?
Cordiali saluti, Dc.
// array(7,-10) per includere cat 7 ed escludere cat 10
$laargsM = array('category' => 7, 'posts_per_page'=>300, 'orderby'=>'title', 'order'=>'asc' );
$la_shapes = get_posts( $laargsM );
Tutte le risposte alla domanda
1
1
Poiché 'get_posts()' utilizza i parametri di 'WP_Query()', presumo che questo dovrebbe funzionare:
$laargsM = array(
'cat' => 7,
'posts_per_page' => 300,
'orderby' => 'title',
'order' => 'asc',
'category__not_in' => array(10)
);

Michael
8.41K
9 set 2011 14:39:27
Domande correlate