Ticket #22074: use-in-query.diff
File use-in-query.diff, 1.5 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
3506 3506 $cache = array(); 3507 3507 3508 3508 $inclusions = ''; 3509 if ( ! empty($include) ) {3509 if ( ! empty( $include ) ) { 3510 3510 $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include 3511 3511 $parent = -1; 3512 3512 $exclude = ''; … … 3514 3514 $meta_value = ''; 3515 3515 $hierarchical = false; 3516 3516 $incpages = wp_parse_id_list( $include ); 3517 if ( ! empty( $incpages ) ) { 3518 foreach ( $incpages as $incpage ) { 3519 if (empty($inclusions)) 3520 $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage); 3521 else 3522 $inclusions .= $wpdb->prepare(' OR ID = %d ', $incpage); 3523 } 3524 } 3517 3518 if ( ! empty( $incpages ) ) 3519 $inclusions = ' AND ID IN (' . join( ',', $incpages ) . ')'; 3525 3520 } 3526 if (!empty($inclusions))3527 $inclusions .= ')';3528 3521 3529 3522 $exclusions = ''; 3530 if ( ! empty($exclude) ) {3523 if ( ! empty( $exclude ) ) { 3531 3524 $expages = wp_parse_id_list( $exclude ); 3532 if ( ! empty( $expages ) ) { 3533 foreach ( $expages as $expage ) { 3534 if (empty($exclusions)) 3535 $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage); 3536 else 3537 $exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage); 3538 } 3539 } 3525 if ( ! empty( $expages ) ) 3526 $exclusions = ' AND ID NOT IN (' . join( ',', $expages ) . ')'; 3540 3527 } 3541 if (!empty($exclusions))3542 $exclusions .= ')';3543 3528 3544 3529 $author_query = ''; 3545 3530 if (!empty($authors)) {