Visualizzazione 2 filoni di risposte
Visualizzazione 2 filoni di risposte
- Devi essere connesso per rispondere a questo topic.
Email: info@wpitaly.it
Home › Forum › Problemi Vari con WP › tag__not_in
Ciao a tutti.
Ho un problema con una query.
O meglio ce l’ho solo con la funzione ‘tag__not_in’ di query_post
Nonostatnte le info su codex http://codex.wordpress.org/Function_Reference/query_posts, IMHO il comportamento di questa funzionr e’ anomalo.
Per escludere un solo tag devo usare l’array
'tag__not_in' => array('1513'),
Cosa che invece non e' necessaria quando voglio includere uno o piu' tag.
Ma il mio problema e' che non riesco in alcun modo a dirgli di usare due o piu' tag da ecludere (nella query viene processato solo e comunque il primo valore).
qui sotto la parte di query incriminata
$args = array(
'numberposts' => -1, // Numero di post per pagina, -1 = infiniti
'post_status' => null,
'tag__not_in' => array('1513'),
'tag' => 'luna-two-cc t-space',
'meta_key' => 'Object type',
'meta_value' => 'Mobile Weapon',
'orderby' => 'title',
'order' => 'ASC',
);
Sia che usi la virgola o lo spazio per separe gli id degli altri tag che voglio escludere, nei risultati vengono esclusi solo i post che hanno il primo tag elencato in 'tag__not_in' => array('xxxx'),
Any idea?
forse perchè gli id devi passarli cosà¬:
‘tag__not_in’ => array(21,456,329)
come mostrato anche negli esempi del codex…
http://codex.wordpress.org/Function_Reference/query_posts#Tag_Parameters
Si grazie.
Oppure cosi’ ‘tag__not_in’ => array(‘1513′,’1131′,’1127′,’1135’), con ogni id racchiuso tra apici.
Prob risolto, grazie mille!
P.S. peccato non esista l’equivalente che permetta di usare gli slug dei tag invece degli id….
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0