Home › Forums › General Issues › how to query by asc or des › Reply To: how to query by asc or des
Hi,
at first.
post_type is the Type of the Post. That means post_type = “post”, if you create post with normal wordpress features.
Here the Codex
For example the Navigation Elements are an other post_type. Beside that there are custom Post Types.
meta_key is the key in the database. In ACF the key of Single Fields is always the name of their field.But you don’t need the key. Because the Star Field is linked with the post.
I think you create a post and have the star_rating field for each post. So you have to query all posts with the post_type =”post”.
$posts = get_posts(array(
'post_type' => 'post',
'posts_per_page' => -1,
'orderby' => 'star_rating',
'order' => 'DESC'
));
Hope It helps.
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.