A closing parenthesis was missing in my example
$args = array( 'numberposts' => -1, 'post_type' => 'OGs', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_key' => 'city', 'meta_query' => array( array( 'key' => 'state', 'value' => 'texas', ), ) );
I tested my code in a fresh install of WP, it outputs all the posts with a state value of texas (text input custom field named state) and sort by city alphabetical (with another text input custom field named city).
the only difference in my test is that i didn’t test with the same post_type, let me know if you still having issues.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future.— Advanced Custom Fields (@wp_acf) January 6, 2023
© 2023 Advanced Custom Fields.