Title: Conditional WP_query with Meta_query
Last modified: August 30, 2016

---

# Conditional WP_query with Meta_query

 *  [eGuard](https://wordpress.org/support/users/eguard/)
 * (@eguard)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/conditional-wp_query-with-meta_query/)
 * I am trying to create a loop where posts are displayed from autor 1, or if the
   post contains metavalue in the field metakey.
 * I came up with below code, but I cant get it to work
 *     ```
       $args = array( relation' => 'OR',
           array ('author' => 1 ),
           array ('meta_query' =>
             array(
               'key' => 'metakey',
       	'value' => 'metavalue',
                  )
                 )
         );
       ```
   
 * Also in case it works, will it show twice if match both author 1 AND the metavalue
   in metakey?

The topic ‘Conditional WP_query with Meta_query’ is closed to new replies.

## Tags

 * [meta_query](https://wordpress.org/support/topic-tag/meta_query/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [eGuard](https://wordpress.org/support/users/eguard/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/conditional-wp_query-with-meta_query/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
