[wp-hackers] meta_query using the same key twice.

Jonathan Brinley jonathanbrinley at gmail.com
Tue Jun 7 00:27:31 UTC 2011


Probably be more more efficient to filters posts_where and write some
SQL, but you could accomplish your goal using AND.

$args=array(
  'post_type' =>'special_stuff',
  'post_status' => 'publish',
  'meta_query' => array(
    array(
      'key' => '_expiration_date',
      'value' => array(0, current_time('timestamp')),
      'compare' => 'NOT BETWEEN'
    ),
    array(
      'key' => '_expiration_date',
      'value' => -1,
      'compare' => '>='
    )
  )
);

Have a nice day,
Jonathan


On Mon, Jun 6, 2011 at 8:13 PM, Daniel Cameron <dan at sproutventure.com> wrote:
>> That should work, By default it's AND'd together from memory.
>
>
> Thanks Dion but I forgot to mention an important detail...
>
> I'd like it to act like an OR statement.
>
> Looks like I'll have to write a SQL.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Jonathan M. Brinley

jonathanbrinley at gmail.com
http://xplus3.net/


More information about the wp-hackers mailing list