Home › Forums › General Issues › need to select first item in meta_value array to sortby › Reply To: need to select first item in meta_value array to sortby
<?php
$args = array(
'relation' => 'AND',
'cat' => 5,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'floor_type',
'value' => $floor_type
),
array(
'key' => 'stack_type',
'value' => $stack_type
),
array(
'key' => 'plumbing_opening',
'value' => $plumbing_opening
)),
'meta_key' => 'application_type',
'orderby' => 'meta_value',
'order' => 'ASC'
);
$posts = query_posts($args);
?>
Sorry, I was using the $meta_value as an example. Currently the orderby ‘meta_value’ is an array from client having saved the post with multiple values when selecting the checkboxes. Is it possibly to select just the first item in array to orderby? This make anymore sense. Thank you so much for your help!
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.