diff --git a/wp-includes/meta.php b/wp-includes/meta.php
index 22b0315..b8a761e 100644
a
|
b
|
class WP_Meta_Query { |
672 | 672 | $meta_query = array(); |
673 | 673 | |
674 | 674 | // Simple query needs to be first for orderby=meta_value to work correctly |
675 | | foreach ( array( 'key', 'compare', 'type' ) as $key ) { |
676 | | if ( !empty( $qv[ "meta_$key" ] ) ) |
| 675 | foreach ( array( 'key', 'compare', 'type', 'exclude_empty' ) as $key ) { |
| 676 | if ( ( 'exclude_empty' === $key && isset( $qv[ "meta_$key" ] ) ) |
| 677 | || ! empty( $qv[ "meta_$key" ] ) ) |
677 | 678 | $meta_query[0][ $key ] = $qv[ "meta_$key" ]; |
678 | 679 | } |
679 | 680 | |
… |
… |
class WP_Meta_Query { |
780 | 781 | continue; |
781 | 782 | } |
782 | 783 | |
783 | | $join[$i] = "INNER JOIN $meta_table"; |
| 784 | $exclude = true; |
| 785 | if ( isset( $q['exclude_empty'] ) ) |
| 786 | $exclude = $q['exclude_empty']; |
| 787 | |
| 788 | $join_type = $exclude ? 'INNER' : 'LEFT'; |
| 789 | |
| 790 | $join[$i] = $join_type . " JOIN $meta_table"; |
784 | 791 | $join[$i] .= $i ? " AS $alias" : ''; |
785 | 792 | $join[$i] .= " ON ($primary_table.$primary_id_column = $alias.$meta_id_column)"; |
786 | 793 | |