Forum Replies Created

Viewing 361 replies (of 361 total)
  • Hi guys,
    I have survived a lot with taxonomy and terms. At last i found a solution at least. I have tried with everything, like witting custom query arguments, using that taxonomies and term fields and lot more other way. At last i found a solution but it is also like two pre-test before the main test. Here we go with the codes…
    If you want to do the query with a post id, first retrieve the term ids array.
    $term_ids = wp_get_object_terms( $post_id, $taxonomies );

    Now we have our term ids array. Let retrieve the post ids associated with our terms.
    $post_ids = get_objects_in_term( $term_ids, $taxonomies ) ;
    Now we got all of the post ids array. So you should know the next step i think.

    $query_args = array( 'post__in' => $post_ids, 'post_type' => $post_type, 'post_status' => $post_status ) ;
    query_posts( $query_args ) ;
    ............................

    I am not sure if it can help you, but this codes really works. You can do a single term query with the simple term and taxonomy arguments, but this method is for multiple terms query together.

Viewing 361 replies (of 361 total)