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!
© 2022 Advanced Custom Fields.