Search code examples
wordpresswordpress-rest-api

Event Espresso API is missing permissions


Background

My client has a WordPress site which uses Event Espresso.

It exposes an API to serve up many events which can be seen here.

But there is one upcoming event which isn't in the array. When I try to access it directly (address), I get:

{
    "code": "rest_user_cannot_read",
    "message": "Sorry, you cannot read this event. Missing permissions are: ee_read_events,ee_read_others_events,ee_read_private_events",
    "data": {
        "status": 403
    }
}

Note that I can access other events like that no problem.

I can see it on the frontend, and it's sold out, but I don't think that is the problem because I temporarily raised the max number of tickets so it wasn't sold out anymore... but the problem persisted.

I've compared it to other events countless times and I can't figure out what else is different. It's not set to private, and it has the same author as the other events.

What am I missing?


Solution

  • The event's post status is likely set to sold_out, even if you've changed the ticket limits. There's actually a bug Event Espresso related its usage of a custom added "sold_out" post status, related to the issue reported here:

    https://github.com/eventespresso/event-espresso-core/issues/278

    So when it processes the GET request it sees that the event's post status isn't Published which leads to the unexpected the 403 error.