IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
287 | 287 | 'post_parent' => '', |
288 | 288 | 'post_status' => '', |
289 | 289 | 'post_type' => '', |
| 290 | 'post_type__in' => get_post_types(), |
| 291 | 'post_type__not_in' => '', |
290 | 292 | 'status' => 'all', |
291 | 293 | 'type' => '', |
292 | 294 | 'type__in' => '', |
… |
… |
|
761 | 763 | |
762 | 764 | // If any post-related query vars are passed, join the posts table. |
763 | 765 | $join_posts_table = false; |
764 | | $plucked = wp_array_slice_assoc( $this->query_vars, array( 'post_author', 'post_name', 'post_parent' ) ); |
| 766 | $plucked = wp_array_slice_assoc( $this->query_vars, array( 'post_author', 'post_name', 'post_parent', 'post_type__in', 'post_type__not_in' ) ); |
765 | 767 | $post_fields = array_filter( $plucked ); |
766 | 768 | |
767 | 769 | if ( ! empty( $post_fields ) ) { |
… |
… |
|
769 | 771 | foreach ( $post_fields as $field_name => $field_value ) { |
770 | 772 | // $field_value may be an array. |
771 | 773 | $esses = array_fill( 0, count( (array) $field_value ), '%s' ); |
772 | | $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $field_value ); |
| 774 | |
| 775 | /* |
| 776 | * Introduce a switch case for the field names to handle special cases where the $field_name does |
| 777 | * not match the actual column name |
| 778 | */ |
| 779 | switch( $field_name ) { |
| 780 | case 'post_type__in': |
| 781 | $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $field_value ); |
| 782 | break; |
| 783 | case 'post_type__not_in': |
| 784 | $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.post_type NOT IN (" . implode( ',', $esses ) . ')', $field_value ); |
| 785 | break; |
| 786 | default: |
| 787 | $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $field_value ); |
| 788 | } |
773 | 789 | } |
774 | 790 | } |
775 | 791 | |