Category page showing all posts when sorting by custom field
-
Hi,
I’m having trouble with WP_Query.
I’m using Advanced Custom Fields to add an “original date” to my posts, then sorting posts by that date. Until that point, it works. But when I try to only see posts form X category, it keeps showing all posts. Actually, it only shows as many pages of all posts -regardless of category- as there would be in the selected category.
This is the code I’m using to sort by custom date<?php // query $the_query = new WP_Query(array( 'post_type' => 'post', 'meta_key' => 'original_date', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'paged' => get_query_var( 'paged' ) )); ?> <?php if( $the_query->have_posts() ): ?> <?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
Thanks in advance
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Category page showing all posts when sorting by custom field’ is closed to new replies.