Skip to content
Drempd Logo
  • home
  • portfolio
  • web design journal
  • blog
    • adventure
    • san diego
    • projects
    • website design
    • code notes
  • contact
Blog Web Dev WordPress Meta Query Mix Relation

WordPress Meta Query Mix Relation

By Forrest Smith - Drempd.com

Using a mix of 'And' and 'Or' operators in the meta_query portion of wordpress get posts query. Specifically with this one, I was looking for an event that had a tag specified by the $show variable, and where the date to see if it was current was either the start or end date of the event (the start date was the only required field in the admin side, so some events don't have end dates).

$args['meta_query'] = array(

  'relation' => 'AND',

   array(

      'key' => 'tags',

      'value' => '"'.$show.'"',

      'compare' => 'LIKE',

   ),

   array(

     'relation' => 'OR',

      array(

         'key' => 'event_date_end',

         'value' => date("Ymd000000"),

         'compare' => '>='

      ),

      array(

         'key' => 'event_date',

         'value' => date("Ymd000000"),

         'compare' => '>='

      )

   )

);

Posted on September 21, 2022August 28, 2025 in Web Dev

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I love to create and explore. Whether building a website or app, taking a long walk through the mountains, or playing with a random idea, I've found that there will never be enough time to experience it all. But that won't stop me from trying.

Web Design & Development

  • Portfolio
  • San Diego Website Design
  • Custom Web Design
  • Responsive Web Design
  • Website Maintenance
  • Freelance Web Designer
  • Web Design Posts
  • Website Checklist

Projects

  • Zindash
  • Opti
  • Saphire CSS
  • Ergo Blocks

Blog

  • Adventure
  • San Diego
  • Projects
  • Website Design
  • Technology
  • Code Notes

About

  • Bluesky
  • Resume
  • Contact
drempd | san diego, ca
© 2026 Drempd All rights reserved.