Support

Account

Home Forums General Issues WP_Query orderby date field does not work Reply To: WP_Query orderby date field does not work

  • I forgot to reply my own post. I find the issue and the resolution. I post it if anyone ever has the same problem.

    Actually, I was using a re-order plugin on the post-type I tried to query, called Post-Types-Order.
    This plugin seems to automaticaly apply a filter for all queries that are pointed the re-ordered post-type. Even in your own code.

    There’s a way to prevent that in the API, by adding a parameter in the query args :

    ignore_custom_sort' => true

    You can find an example here : https://www.nsp-code.com/advanced-post-types-order-api/sample-usage/ (Don’t need to get advanced version to use it).