WordPress.org

Make WordPress Core

#43350 closed feature request (wontfix)

REST API: Support for WP Cron

Reported by: bhubbard Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.1
Component: REST API Keywords:
Focuses: rest-api Cc:
PR Number:

Description

I would like to see the Rest API, support WP Cron. Here are the endpoints I think make sense:

  • view, create, delete, and update cron schedules
  • view, create, delete, update, and run cron events

Change History (3)

This ticket was mentioned in Slack in #core-restapi by schlessera. View the logs.


20 months ago

#2 @schlessera
20 months ago

Properly supporting scheduled events through the REST API would only make sense of:

  1. They are treated as a resource, complete with CRUD methods.
  2. They have some usefulness in client-side code.

The second point is the more complicated one. However, this might be feasible if we would have a smart callback on the PHP side that transports triggered events through the Heartbeat API into the client-side JS space. This way, WordPress Core could take care of mapping PHP events to JS events, and you could then hook a JS callback to such an event.

The question is what to do with such events if the JS callback is not loaded yet. They could be stored, but that would not scale in case there is a general issue and the store quickly fills up.

#3 @rmccue
20 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

WP Cron is an internal API, not something we want to expose publicly. Additionally, cron schedules are defined in code, not as resources in the database. We aren't planning on adding support for this any time in the forseeable future.

Note: See TracTickets for help on using tickets.