Last active
December 16, 2015 23:19
-
-
Save rgsmith1980/5513583 to your computer and use it in GitHub Desktop.
WordPress query_posts by meta field for custom post type
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_posts(array( | |
'post_type' => 'your-post-type-here', | |
'meta_key' => 'your-meta-key-name', | |
'meta_query'=> array( | |
array( | |
'key'=>'your-meta-key-name', | |
'value'=> 'your-search-val', | |
'compare' => '=' | |
)), | |
'orderby' => 'meta_value_num', | |
'order' => 'ASC' | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment