• Kyle

    (@kylebravotangoca)


    Posts are not correctly sorted by Meta Value on the frontend.

    When looking at the admin page using AQL, the posts query works and is sorted correctly.
    When manually querying the REST API, the posts query works and is sorted correctly.
    When manually querying with WP_query and meta_query, the posts query works and is sorted correctly.

    When viewing the front-end of the page using the AQL, the posts query are out of order. I’ve verified there is no pre_get_posts or other function modifying the main query.

    Here is a screenshot of the admin settings:

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ryan Welcher

    (@welcher)

    Hello and thanks for using AQL!

    I’m sorry you’re running into this. I’ll need to set this up locally to debug it. Can I assume that the last_name field is a the lowercase version of the last name being displayed?

    Is this a custom post type or just posts with a category assigned?

    Is the issue that there are missing people or just out of order? The reason I ask is that Laura Ambrose is missing from the provided link but in the screenshot.

    Thanks for your patience here!

    Thread Starter Kyle

    (@kylebravotangoca)

    Yes, I can confirm that last_name (all lowercase) is the field:

    I can also confirm that the posts all contain the last_name:

    I can verify that the filed is retrievable using ACF get_field() or get_post_meta().

    They are also available in the REST API as acf.last_name:
    https://www.luthercollege.edu/wp-json/wp/v2/posts?per_page=100&_fields=id,title,acf
    https://www.luthercollege.edu/wp-json/wp/v2/posts/1316

    I don’t think any are missing, Laura Ambrose is just out of order at the bottom of the list on the frontend:

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post Order By Meta Value Not Working’ is closed to new replies.