Support » Fixing WordPress » Loop through multiple custom taxonomy terms and display posts for a custom post

Viewing 2 replies - 1 through 2 (of 2 total)
  • change this
    $posts = new WP_Query( array(
    ‘taxonomy’ => $taxonomy,
    ‘term’ => $term->slug,
    ‘posts_per_page’ => ‘-1’
    with
    $posts = new WP_Query( array(
    ‘links_categories’ => $term->slug,
    ‘posts_per_page’ => ‘-1’

    Thread Starter Thomas Hitz

    (@thitz)

    Thank you for your help!

    I had to add the post_type to the query – and with that additional line to your suggestion it works. Just for sake of completeness here is the working code:

    $posts = new WP_Query( array(
    'post_type' => $post_type,
    'links_categories' => $term->slug,
    'posts_per_page' => '-1'));
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Loop through multiple custom taxonomy terms and display posts for a custom post’ is closed to new replies.