WordPress category & taxonomy loop with pagination
-
I have two taxonomies belonging to the same post type (posts).
Adventure – belonging to the category taxonomy
Adventure – belonging to the holiday-type taxonomyI want to run two queries:
$args = array( 'post_type' => 'post', 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'holiday-types', 'field' => 'slug', 'terms' => 'adventure', ), array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => 'adventure', ), ), ); $the_query = new WP_Query( $args );
Even though the terms are the same they have different posts associated to them.
This query only returns posts with the holiday-types taxonomy and not the category taxonomy too. If I comment out the array with the holiday types, then the taxonomy category shows the relevant posts.
I need them to both show together as well as with pagination.
'paged' => get_query_var('paged')
I have read that i need to add this to the first array but i guess i cant test this until i get the loop working correctly first.
Any ideas where I am going wrong please?
- The topic ‘WordPress category & taxonomy loop with pagination’ is closed to new replies.