WordPress.org

Make WordPress Core

Opened 9 years ago

Last modified 9 years ago

#14892 closed enhancement

minor improvement on category__in — at Initial Version

Reported by: sboisvert Owned by:
Milestone: 3.1 Priority: normal
Severity: minor Version: 3.1
Component: Query Keywords:
Focuses: Cc:
PR Number:

Description

if categoryin is only provided an int, it will fail (relatively silently). I find this to be "not friendly"

If I may suggest changing lines 1371-1372 in /wp-includes/query.php to this:

if ( !is_array($qvcategory__in?)
empty($qvcategory__in?) ) {
if (is_long($qvcategory__in?)
is_int($qvcategory__in?)){

$qvcategory__in? = array($qvcategory__in?);

} else{

$qvcategory__in? = array();

}

I would in the same vein implement the change for categorynot_in

if ( !is_array($qvcategory__not_in?)
empty($qvcategory__not_in?) ) {
if (is_long($qvcategory__not_in?)
is_int($qvcategory__not_in?)){

$qvcategory__not_in? = array($qvcategory__not_in?);

} else{

$qvcategory__not_in? = array();

}

I would also suggest implementing for tagin and etc etc

Change History (0)

Note: See TracTickets for help on using tickets.