• Resolved snookian

    (@snookian)


    HI, Sorry if this has been asked before and I have tried to find documentation on the website but can’t find much in relation to custom taxonomy.

    I have a custom post created in two PODS called ‘admin-resources’ and ‘coach-resources’ then I have a Custom Taxonomy which is called ‘admin-resources-categories’ and ‘coach-resources-categories’

    I am trying to use the WP query loop to output the posts with a certain category. So for example. In the below example I am trying to get the titles for all the ‘admin-resources’ with the taxonomy called ‘launch’ that is within the taxonomy POD is setup called ‘admin-resources-categories’.

    $post_args = array( 'post_type' => 'admin-resources', 'posts_per_page' => -1, 'taxonomy' => 'launch' );
    $post_loop = new WP_Query( $post_args );
    while ( $post_loop->have_posts() ) : $post_loop->the_post();
        global $post;
        $postname = 'admin-resources';
        $pod = pods($postname, $post->ID);
        ?>
          <h2><?php echo the_title( ); ?></h2>
        <?php
    endwhile;
    wp_reset_query();

    The ‘launch’ category is not part of the WordPress core categories which what I suspect I am trying to solve. Any ideas?

    • This topic was modified 3 years, 8 months ago by snookian.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom posts by Taxonomy in WP_Query’ is closed to new replies.