Problem: I am trying to use a meta_query with the post relationships API toolset_get_related_posts, but it doesn't seem to be filtering as expected.
Solution: Some complex meta_queries, like using "IN" or "AND" with more than one term, fail with the post relationships API. Instead, you should use a standard WP_Query and add the toolset_relationships clause:
$args = array( 'numberposts' => -1, 'post_type' => 'child-post-type-slug', 'orderby' => 'post_date', 'order' => 'DESC', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'wpcf-colour', 'value' => 'Red', 'compare' => '=' ), array( 'key' => 'wpcf-description', 'value' => 'Ball', 'compare' => '=' ) ), 'toolset_relationships' => array( 'role' => 'child', 'related_to' => $post_id, 'relationship' => 'relationship-slug' ), ); $child_query = new WP_Query( $args );
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Ce sujet contient 2 réponses, a 2 voix.
Dernière mise à jour par Il y a 4 années et 9 mois.
Assisté par: Christian Cox.