Querying and sorting posts/communities by fields in custom data

Hello, Support Team!

On our website, we have events and challenges, both with a creationDate and a startDate. I store challenges as custom posts, with startDate saved in the post.data section. We also have a UI element that displays a list of upcoming challenges.

Is there a way to select and sort posts by startDate, or what would be the recommended approach?

Thanks!

Hello @dmitryvm ,

Custom posts do not support sorting because they are stored as a single object, meaning data fields like startDate cannot be used for sorting. The recommended approach is to sort posts using the default sorting method (by creation date or latest date).

Please refer to this documentation for more details:
:link: Custom Posts