Created
May 2, 2013 22:59
-
-
Save astockwell/5506110 to your computer and use it in GitHub Desktop.
WP_Query by meta_value first letter
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
<?php | |
$args = array( | |
'post_type' => 'faculty', | |
'meta_query' => array( | |
// 'relation' => 'AND', | |
// array( | |
// 'key' => 'online-extra-type', | |
// 'value' => 'Your Space', | |
// 'compare' => '=' | |
// ), | |
array( | |
'key' => 'faculty-last-name', | |
'value' => array( 'L', chr(ord('L')+1) ), | |
'orderby' => 'meta_value', | |
'compare' => 'BETWEEN', | |
'order' => 'ASC' | |
), | |
array( | |
'key' => 'faculty-last-name', | |
'value' => chr(ord('L')+1), | |
'orderby' => 'meta_value', | |
'compare' => '!=' | |
) | |
) | |
); | |
$devquery = new WP_Query( $args ); | |
print_r($devquery); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment