Home Forums Front-end Issues Order by acf date field.


Order by acf date field.

  • Hello! I was trying to order my posts based on ACF date field. The field has a “Ymd” date format (YYYYMMDD) and the orderby is set to meta_value_num. The weird thing is that if order it DESC, the order is correct, but if I order it ASC, the order gets wrong. Would someone have an idea why does this happen? Am I doing something wrong?

    I am attaching my ACF settings + the correct and the wrong order display.

  • I’d have to see your query. There must be something in it that’s incorrect or overriding the date field.

  • This reply has been marked as private.
  • I don’t see anything in your query that should be causing the order to be incorrect. Do you have any plugins and/or filters that could be interfering? A pre_get_posts filter maybe?

  • Thanks. It was the plugin “Post types order” that was messing with it 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.