Last active
January 29, 2018 14:54
-
-
Save alimoshen/b3fbf4330f4c53831b03f486deb703e8 to your computer and use it in GitHub Desktop.
WordPress query exclude custom field value and when it doesn't exist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$query = array( | |
'post_type' => 'profiles', | |
'meta_query' => array( | |
'relation' => 'OR', | |
array( | |
'key' => 'disable_profile', | |
'compare' => '==', | |
'value' => 'disabled', | |
), | |
array( | |
'key' => 'disable_profile', | |
'compare' => 'NOT EXISTS', | |
), | |
), | |
'order' => ASC, | |
'posts_per_page' => $post_per_page, | |
'paged' => $paged | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment