[wp-trac] [WordPress Trac] #29418: Taxonomy archive query not including all of its post types.
WordPress Trac
noreply at wordpress.org
Tue Dec 8 22:55:12 UTC 2015
#29418: Taxonomy archive query not including all of its post types.
--------------------------+-----------------------------
Reporter: msaggiorato | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Taxonomy | Version: 3.9.2
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+-----------------------------
Comment (by DoodleDogCody):
One thing not mentioned in a few of these "exclude_from_search" templates
that I have stumbled upon is that if we set it to true and then try a
custom loop for the CPT with a taxonomy term in a tax query. We can only
get the 1st page of results. So using something like the following only
returns results for the first page, while the rest of the pages return a
404. So if at the end of our loop we have some pagination, the pagination
knows how many pages there are but when going to those pages it just
stops.
I agree with the previous posters that something here really needs to
change. 'exclude_from_search' should do just that and exclude_from_search
while another parameter 'publically_queryable' or some new parameter is
used here. Not wanting search results to return this CPT but wanting to
have taxonomy archives pages seems like something that might happen a lot
and all the answers to accomplishing this seem like big workarounds.
{{{
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$taxonomy = get_query_var( 'taxonomy' );
$term = get_query_var( 'term' );
$args = array(
'post_type' => 'ddc-products',
'posts_per_page' => 5,
'paged' => $paged,
'tax_query' => array(
array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => $term,
),
),
);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29418#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list