Title: WP Query Taxonomy Posts
Last modified: August 30, 2016

---

# WP Query Taxonomy Posts

 *  [Darkkz](https://wordpress.org/support/users/darkkz/)
 * (@darkkz)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/wp-query-taxonomy-posts/)
 * Hello,
 * I am working on my first theme from scratch and I encountered an issue while 
   retrieving some posts linked to a taxonomy. Basically, I have some posts that
   are linked to a category news (seven posts). Then two of them are linked also
   to a custom taxonomy called ‘sliderType’ which has a category called Big Slider
   Home. When I try to retrieve all the posts linked to that taxonomy I somehow 
   get all the posts from the database.
 * This is the code of the taxonomy..
    `add_action( 'init', 'create_cat_slider' );`
 * function create_cat_slider() {
    register_taxonomy( 'sliderType','post', array('
   label' => __( 'Slider' ), 'hierarchical' => true, ) ); }
 * .. and these are some versions of the loop
 * $args = array(
    ‘taxonomy’ => ‘sliderType’ ); $custom_query = new WP_Query( $
   args ); echo $custom_query->post_count; if($custom_query->have_posts()) //rest
   of the loop
 * OR
 * $custom_query = new WP_Query( array( ‘post_type=post&cat=10’ ) );
    echo $custom_query-
   >post_count; if($custom_query->have_posts()) : //rest of the loop
 * I even tried some variations with tax_query in the array ( and I know it has 
   to be an array in an array).
 * I have no idea what am I missing and I would be grateful if anyone could help
   me deal with this issue.
 * Cheers

The topic ‘WP Query Taxonomy Posts’ is closed to new replies.

## Tags

 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Darkkz](https://wordpress.org/support/users/darkkz/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/wp-query-taxonomy-posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
