[wp-trac] [WordPress Trac] #10908: Impossible to exclude categries in a category listing
WordPress Trac
wp-trac at lists.automattic.com
Mon Oct 5 16:43:46 UTC 2009
#10908: Impossible to exclude categries in a category listing
-----------------------------+----------------------------------------------
Reporter: dimitryz | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Unassigned
Component: General | Version: 2.8.4
Severity: normal | Keywords: category, wp_query, category__not_in
-----------------------------+----------------------------------------------
Setting the 'category!__not_in' `query_var` in a `WP_Query` object does
nothing if 'category_name' is also present. The consequence is that it's
impossible to hide the posts of some child categories for a category
listing.
The offending code is in line 1843:
{{{
$whichcat = " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
}}}
A dot (.) should be added before the equal (=) to indicate concatenation:
{{{
$whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
}}}
The proposed solution enabled the addition of categories ('category!__in')
and exclusion of categories ('category!__not_in') when the following
condition is met:
{{{
if ( '' != $q['category_name'] && !$this->is_singular ) {
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10908>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list