WP Query per ottenere tutti i post (inclusi bozze/in attesa di revisione)
28 feb 2012, 00:38:14
Visualizzazioni: 27.1K
Voti: 4
Attualmente ho la seguente query:
$args = array(
'post_type' => 'post',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => 10,
);
$my_query = new WP_Query($args);
while ($my_query->have_posts()) : $my_query->the_post(); ?>
Questa query restituisce tutti i post che sono pubblicati. Come posso modificarla per mostrare ogni post, sia esso pubblicato, in attesa di approvazione o in bozza?

Kyle
1.05K
Tutte le risposte alla domanda
2
0
Puoi aggiungere post_status alla tua query, la stringa 'any' restituirà tutti i post indipendentemente dallo stato, oppure puoi utilizzare un array per recuperare solo quelli che desideri.
$args = array(
'post_type' => 'post',
'orderby' => 'title',
'order' => 'ASC',
'post_status' => 'any',
'posts_per_page' => 10,
);
http://codex.wordpress.org/Class_Reference/WP_Query#Status_Parameters

Rachel Baker
1.95K
28 feb 2012 01:17:32
Domande correlate
3
risposte
2
risposte