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.