Skip to content
GPLWP Guides

How to share WordPress event data through an API

Developer ToolsWordPress Time About 30–90 minutes 6 steps Updated 17 Nov 2026

DEVELOPER TOOLS
The short answer

For simple public event data, WordPress can expose a custom post type through its REST API without another plugin. You must register the event type for REST, expose its date and venue fields, then test the JSON response. For recurring events or MEC data, an event API add-on is usually quicker.

The route
  1. 01Define the event data contract
  2. 02Expose the event post type
  3. 03Publish the event fields
  4. 04Choose public or private access
  5. 05Test the JSON response
  6. 06Use an event API add-on

What you need

  • WordPress administrator or developer access
  • An event post type or event calendar plugin
  • HTTPS enabled on the site
  • The field list and JSON format required by the receiving app

Define the event data contract

Write down the fields the other application needs before touching the API: event ID, title, description, start and end times, timezone, venue, image, booking URL, categories and whether the event is published. Decide whether the feed is public and read-only or whether the other system must create and update events.

Use one consistent date format and timezone. Recurring events are the usual source of confusion: decide whether one series should be returned once, or whether every occurrence should become a separate item.

Expose the event post type

If your events are stored in a custom post type, register it with show_in_rest => true. WordPress then creates a route in the wp/v2 namespace. You can set a clearer route with rest_base; for example, an event type could be available at /wp-json/wp/v2/events.

If a plugin already owns the event post type, do not edit its files. Add REST support with the documented post-type arguments filter, or use the plugin's own API if it provides one. Flush permalinks only if the route is not found after the change.

Publish the event fields

Register event metadata such as start time, end time, venue and booking URL with show_in_rest enabled. The event post type also needs custom-fields support for registered meta to appear in REST responses. Use register_post_meta for normal fields and define a JSON schema for object or array values.

For calculated or reshaped values, add a REST field at rest_api_init instead. This is useful when the receiving app expects one combined date object, a clean venue object or a field name that does not match the database meta key.

Choose public or private access

A public read-only event feed can be requested without login, but do not expose attendee names, private notes, draft events or internal booking data. For protected reads or writes, use HTTPS and a dedicated WordPress user with only the required capabilities.

WordPress Application Passwords provide revocable credentials for scripts and integrations. Create one under Users → Profile → Application Passwords, store it immediately, and send it with HTTP Basic Authentication. Never put the credential in browser JavaScript or commit it to source control.

Test the JSON response

Open the collection endpoint, such as https://example.com/wp-json/wp/v2/events?per_page=10, and confirm that published events, pagination, titles, links and all required date fields are present. Use _fields=id,title,meta,link to inspect only the fields your integration needs.

Test an event with a missing venue, an all-day event, a timezone different from the site timezone, a recurring event and an unpublished event. A common Friday failure is that the event plugin stores recurrence data in its own tables or private fields, so the normal WordPress endpoint returns the event title but not every occurrence.

Use an event API add-on

If your events already live in Modern Events Calendar and the receiving app needs live event data, the fast route is the MEC Event API Addon. It provides MEC-specific endpoints for retrieving and managing event data, including schedules, locations and organisers, rather than making you map MEC's internal event structure yourself. Its documented API uses a base such as /wp-json/mec/v1.0, requires an API token header, and includes an events endpoint with pagination controls.

Choose this route when you need recurring events, MEC custom fields or cross-site synchronisation. The manual REST route is fine for a simple custom post type and a small public feed, but an MEC-specific endpoint avoids rebuilding recurrence and event-field handling.

The fast route

Let MEC Event API Addon do it

MEC-specific API endpoints for syncing events and JSON feeds across sites; choose it when external apps need live event data.

Get MEC Event API Addon

Sources

  1. developer.wordpress.org /rest-api/extending-the-rest-api/adding-rest-api-support-for…
  2. developer.wordpress.org /rest-api/extending-the-rest-api/modifying-responses/
  3. developer.wordpress.org /advanced-administration/security/application-passwords/?trk…
  4. support.webnus.net /en/article/mec-restful-api-iytq9x/

Questions

Can WordPress expose events through its REST API without a plugin?
Yes, WordPress can expose a custom event post type without an additional plugin. Register the post type with <code>show_in_rest</code>, register the required event metadata with <code>show_in_rest</code>, and request the resulting <code>wp/v2</code> endpoint. This works well for simple read-only feeds, but it does not automatically understand the recurrence or private data model of an event-calendar plugin.
Why does my event endpoint show the title but not the date or venue?
The date or venue is probably stored as post meta that has not been registered for REST output. Register each required field with <code>show_in_rest</code>, and make sure the custom post type supports <code>custom-fields</code>. If the value is calculated or stored outside normal post meta, add it as a REST field or use the event plugin's own API instead.
Should event data be public or require authentication?
Make a feed public only when every returned field is safe for anyone to read, such as published title, dates, venue and booking link. Require authentication for drafts, private events, attendee information, write operations or internal notes. For integrations, use HTTPS and a separate, revocable Application Password rather than the user's main password.
How do I share recurring event occurrences correctly?
Choose whether your API returns one event series or one item for each occurrence, then keep that choice consistent. WordPress's basic custom post type endpoint does not expand recurrence rules by itself, and many event plugins store occurrence data separately. If your calendar plugin already handles recurrence, use its dedicated API or an add-on that exposes each occurrence in the format your receiving application needs.
What is the fastest way to share Modern Events Calendar data?
The fastest route is an MEC-specific API add-on when your events are managed by Modern Events Calendar. It supplies an MEC API base, token authentication and event endpoints, so you do not have to build custom REST fields or reverse-engineer recurrence data. Use the manual WordPress REST route instead when you only need a small feed from your own custom event post type.