[wp-trac] [WordPress Trac] #22995: WP_Query Category stuff blank page
WordPress Trac
noreply at wordpress.org
Wed Dec 19 15:13:24 UTC 2012
#22995: WP_Query Category stuff blank page
-------------------------------+------------------------------
Reporter: Ninos Ego | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.5
Severity: normal | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Comment (by Ninos Ego):
Think I have found the bug. Adding a non existing category id I get the
descripted error.
On line '''/wp-includes/query.php:1745-1751''' you should check the id:
just replace:
{{{
if ( $in ) {
$q['category__in'][] = $cat;
$q['category__in'] = array_merge( $q['category__in'],
get_term_children($cat, 'category') );
} else {
$q['category__not_in'][] = $cat;
$q['category__not_in'] = array_merge( $q['category__not_in'],
get_term_children($cat, 'category') );
}
}}}
with:
{{{
if( get_category($cat, false) ) {
if ( $in ) {
$q['category__in'][] = $cat;
$q['category__in'] = array_merge( $q['category__in'],
get_term_children($cat, 'category') );
} else {
$q['category__not_in'][] = $cat;
$q['category__not_in'] = array_merge(
$q['category__not_in'], get_term_children($cat, 'category') );
}
}
}}}
Otherwise ''$q['category__in']'' or ''$q['category__not_in']'' have got a
wrong ID and send it in line '''/wp-includes/query.php:1761-1766''' via
{{{
$tax_query[] = array(
'taxonomy' => 'category',
'terms' => $q['category__in'],
'field' => 'term_id',
'include_children' => false
);
}}}
and in line '''/wp-includes/query.php:1771-1776'''
{{{
$tax_query[] = array(
'taxonomy' => 'category',
'terms' => $q['category__not_in'],
'operator' => 'NOT IN',
'include_children' => false
);
}}}
to the tax query. Because of that I get a blank page.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22995#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list