WordPress Debug Bar Cron

WordPress’ cron implementation is a powerful tool for scheduling events in WordPress projects. Its usefulness at times is only matched by the frustration inherent in debugging issues with cron. After my most recent frustrations implementing a WordPress scheduled event, I decided to build Debug Bar Cron, an extension for the fantastic Debug Bar that adds a panel of information about registered events. With 10up teammate Helen Hou-Sandi’s UI love, this plugin helps you easily visualize all of the WordPress scheduled events information to quickly see what is happening with these events.

The plugin focuses on providing developers with the most pertinent information regarding their scheduled events as easily as possible. The “dashboard” shows how many events are scheduled, whether or not WordPress cron ran on the current request, when the next event is scheduled to occur, and the current time for easy comparison for the event times.

The listing of scheduled events are broken into “Custom Events” and “Core Events”. In my experience, I have rarely needed to know about the scheduled events that are programmed by WordPress core. As such, I wanted to separate the “non-core” scheduled events from the core scheduled events in order to make information about the important events easier to access. Core and non-core events are displayed in separate tables.

Each table displays the following information:

  • Time of the next event execution
  • The name of the hook
  • The name of the interval for the hook
  • Numeric value of the interval
  • The arguments for the hook

In addition to showing the scheduled events, the different schedules are shown. In this table, all of the core and non-core intervals are shown.

In this table, the following information is available:

  • Interval name/hook
  • Interval time in seconds, minutes, and hours
  • Display name for the schedule

I am currently working on the next version which will allow you to execute a hooked function on demand and provide a console-like feedback element. Since WordPress scheduled events are executed during a separate request, it can be tough to get feedback about warnings, errors, and notices that are thrown by hooked functions. I hope to develop a console that will give you this information when the events are executed.

If you find any bugs or have any feature requests, be sure to let me know! It’s on GitHub and pull requests are welcome!

  1. […] debugging information for your site. There are lots of ways to use, so I suggest exploring a few notable extensions to get started. You can also use it to do things like plugin benchmarking, so […]

Leave a Comment

We make web publishing easy. Maybe even fun.

hire us apply