My initial situation is, that I have a custom post type events
which are - who would have thought - events. There is a custom UI (backend) where the user can enter multiple dates. Each date is then saved as post meta as a timestamp.
I am then using pre_get_posts
(and a few other filters/actions) to change the query so the posts are displayed based on that timestamp. This is working perfectly when calling the default post type archive page (http://www.example.com/[post-type-slug]/).
We are currently developing an app for mobile phone which then should display the events. We are using the WP REST API to retrive the event data. The problem is that is_main_query()
returns always false when using the REST API.
Does anybody know how i can bypass this problem?