Skip to content

Add actions field to wp cron event list#124

Draft
Copilot wants to merge 9 commits intomainfrom
copilot/add-cron-event-actions-display
Draft

Add actions field to wp cron event list#124
Copilot wants to merge 9 commits intomainfrom
copilot/add-cron-event-actions-display

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

Fix for Failing Test

Issue

The test was failing with Error: Invalid field: actions. because the WP-CLI Formatter validates that requested fields exist on the item objects.

Solution

Initialize the actions property as an empty string on all event objects in format_event(). The lazy-loading logic in list_() then populates it with actual callback data only when the field is explicitly requested.

Implementation Flow

  1. All events get an empty actions property during formatting (performance-neutral)
  2. When user requests --fields=actions, the property is populated with actual hook callback data
  3. The Formatter can now validate the field exists and display it correctly

This maintains the performance benefits of lazy-loading (callbacks are only fetched when needed) while satisfying the Formatter's field validation requirements.

Original prompt

This section details on the original issue you should resolve

<issue_title>wp cron event list should show the actions for each event</issue_title>
<issue_description>I just updated WP-Crontrol so it also shows the actions attached to each cron event. WP-CLI should do the same when you use wp cron event list.</issue_description>

Comments on the Issue (you are @copilot in this section)

@danielbachhuber FYI - `wp cron event list` now lives in https://github.com/wp-cli/cron-command @danielbachhuber Also, `wp profile` has a `get_name_location_from_callback` that might be useful to abstract to `WP_CLI\Utils`: https://github.com/wp-cli/profile-command/blob/master/inc/class-profiler.php#L469 @danielbachhuber Could/should this be solved with documentation instead?

Use wp hook <hook> to inspect the callbacks on each event.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI and others added 2 commits January 25, 2026 17:40
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add actions display for each cron event in wp cron event list Add actions field to wp cron event list Jan 25, 2026
Copilot AI requested a review from swissspidy January 25, 2026 17:48
@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

❌ Patch coverage is 84.37500% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Cron_Event_Command.php 84.37% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

This comment was marked as resolved.

swissspidy and others added 2 commits February 3, 2026 21:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… actions field

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp cron event list should show the actions for each event

2 participants