Make WordPress Core

Ticket #16829: meta_compare.diff

File meta_compare.diff, 664 bytes (added by ldebrouwer, 14 years ago)

Patch that defaults $meta_compare to 'IN' if $qcompare? is not set and $qvalue? is an array.

  • meta.php

     
    389389                $meta_key = isset( $q['key'] ) ? trim( $q['key'] ) : '';
    390390                $meta_value = isset( $q['value'] ) ? $q['value'] : '';
    391391                $meta_compare = isset( $q['compare'] ) ? strtoupper( $q['compare'] ) : '=';
     392                $meta_compare = ( !isset( $q['compare'] ) && is_array( $meta_value ) ) ? 'IN' : '=';
    392393                $meta_type = isset( $q['type'] ) ? strtoupper( $q['type'] ) : 'CHAR';
    393394
    394395                if ( ! in_array( $meta_compare, array( '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) )