wp_query of ALL CPT regardless the taxonomies (1 post)

  1. Giu Tae Kim
    Posted 2 years ago #


    I have my CPT "Pack" with its related taxonomy "class".

    I'm trying to make a wp_query of ALL custom post types, this way:

    $args = array(
     'post-type' => 'pack',
     'class' => 'class-1,class-2,class-3,class-4,class-5,class-6',
     'posts_per_page' => 5,
     'meta_query' => array(array('key' => 'featured','value' => '1','compare' => '='))

    Now... It is rly necessary to declare all classes? Cause I want to show all cpt, no matter the taxonomy...

    If I remove the taxonomy section, the wp_query doesn't show any post.

    This code only works if I put manually every tax term that exist.

    Someone know a better way to make this wp_query shorter???

    Many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic