WP_Query orderby date ne fonctionne pas
-
-
Vous souhaitez commanderpar date avec commande DESC?Peut-être avez-vous unplugin ou lethèmeinterférant avec la requête?Que sepasse-t-il si vous utilisez `` suppress_filters '=>true`?You want to order by date with DESC order ? Maybe you've a plugin or the theme interfering with the query? What happens if you use `'suppress_filters' => true` ?
- 2
- 2016-11-10
- birgire
-
2 réponses
- votes
-
- 2017-07-19
Celafonctionnera certainement ... Cela afonctionnépourmoi ...
$username = get_the_author_meta( 'login', $author_id ); $args = array( 'post_type' => 'any', 'orderby' => 'date', 'order' => 'DESC', 'suppress_filters' => true, 'tax_query' => array( array( 'taxonomy' => 'author', 'field' => 'name', 'terms' => $username ) ) ); $query = new WP_Query( $args );
This will definitely work....It worked for me...
$username = get_the_author_meta( 'login', $author_id ); $args = array( 'post_type' => 'any', 'orderby' => 'date', 'order' => 'DESC', 'suppress_filters' => true, 'tax_query' => array( array( 'taxonomy' => 'author', 'field' => 'name', 'terms' => $username ) ) ); $query = new WP_Query( $args );
-
Celane fonctionnepaspourmoi.Is not working for me..
- 0
- 2017-11-20
- Radmation
-
ajoutez celui-ci dans les arguments 'suppress_filters'=>true,add this one in the args 'suppress_filters' => true,
- 0
- 2020-02-27
- Pravin Work
-
- 2018-02-15
Ajout
'suppress_filters' => true
dans letableau
$args
afait letri dans l'ordre dontj'avaisbesoin.Adding
'suppress_filters' => true
into the
$args
array did sorting in the order I needed.-
Ceciindique qu'unplugin ou un hook dethèmemodifie la requête.This is an indication that a plugin or theme hook is modifying the query.
- 3
- 2018-02-15
- Howdy_McGee
-
Vérifiez si vous avezinstallé leplugin Post Types Order ou sitout autreplugin le désactive.alors la requêtefonctionnebienCheck if you have Post Types Order plugin installed or any other plugin disable it. then query works fine
- 0
- 2020-08-17
- Muddasir
J'ai une simple WP_Querypour obtenir une liste des articles du co-auteur (taxonomie auteur )triéspar date,voici la requête:
Le résultatesttoujours une liste d'articles classéspar date ASC ... J'ai déjà une solution de recherche surinternet sans succès ... Uneidée?
Mercibeaucoup