Docs: Clarify that cron event arguments must match when using wp_sche…#10890
Docs: Clarify that cron event arguments must match when using wp_sche…#10890manishdhorepatil-art wants to merge 14 commits intoWordPress:trunkfrom
Conversation
…dule_event() and wp_next_scheduled()
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Co-authored-by: Weston Ruter <westonruter@gmail.com>
Co-authored-by: Weston Ruter <westonruter@gmail.com>
|
@westonruter changes done here |
|
@westonruter can you please review this i have updated the changes |
src/wp-includes/cron.php
Outdated
| * hook's callback function. Each value in the array | ||
| * is passed to the callback as an individual parameter. | ||
| * The array keys are ignored. Default empty array. | ||
| * @param array $args { |
There was a problem hiding this comment.
Why the introduction of the brace? This is typically only used when describing the structure of the array itself, not for encapsulating a multi-line description. I believe the braces should be removed and the originally indentation restored.
There was a problem hiding this comment.
@westonruter Thanks for the review! You're absolutely right - braces should only be used when describing array structure with @type tags, not for multi-line descriptions. I've removed the braces and restored the proper indentation for both occurrences in the file. can you check now
src/wp-includes/cron.php
Outdated
| * hook's callback function. Each value in the array | ||
| * is passed to the callback as an individual parameter. | ||
| * The array keys are ignored. Default empty array. | ||
| * @param array $args { |
There was a problem hiding this comment.
Ditto above about the brace.
* trunk: Docs: Add missing `@global` variable descriptions.
This commit improves the documentation for the $args parameter in the Cron API to provide consistent and clear guidance on the importance of matching arguments for unique event identification. Summary of changes: - Unified clarification for scheduling functions: Added a consistent explanatory paragraph to wp_schedule_single_event(), wp_schedule_event(), and wp_reschedule_event(). - Synchronized retrieval and removal functions: Updated wp_unschedule_event(), wp_clear_scheduled_hook(), and wp_next_scheduled() to explicitly state that events will not be found if arguments do not match exactly. - Strictly maintained project standards for line wrapping and indentation. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
@manishdhorepatil-art I've added 31d0167 with an assist from Gemini CLI. Please review. |
|
@westonruter yes it is better but we can be precise like this below this seems better Docs: Add clarification about argument matching for cron event identification. This commit adds a clarifying paragraph to wp_schedule_single_event() and Changes:
|
|
@manishdhorepatil-art I don't understand. Be more precise like what below? You copied the commit message from my commit. I'm not sure what you're saying. |
|
@manishdhorepatil-art Still not understanding. Are you proposing an SVN commit message with your above comment? Note the docblocks were updated for these functions:
|
|
@westonruter You're absolutely right. Thank you for the correction! |
|
Did I correct anything? I'm still having a hard time fully understanding your comments. (If you're using AI for contributing, please note that you need to disclose this.) |
…duplicate entries. This harmonizes and clarifies the documentation for the `$args` parameter in `wp_schedule_event()`, `wp_schedule_single_event()`, `wp_reschedule_event()`, `wp_unschedule_event()`, `wp_clear_scheduled_hook()`, and `wp_next_scheduled()`, to emphasize the requirement for matching arguments and the risks of mismatching them. Developed in #10890 Props manishxdp, westonruter, ovidiul, digamberpradhan. Fixes #43801. git-svn-id: https://develop.svn.wordpress.org/trunk@61639 602fd350-edb4-49c9-b593-d223f7449a82
…duplicate entries. This harmonizes and clarifies the documentation for the `$args` parameter in `wp_schedule_event()`, `wp_schedule_single_event()`, `wp_reschedule_event()`, `wp_unschedule_event()`, `wp_clear_scheduled_hook()`, and `wp_next_scheduled()`, to emphasize the requirement for matching arguments and the risks of mismatching them. Developed in WordPress/wordpress-develop#10890 Props manishxdp, westonruter, ovidiul, digamberpradhan. Fixes #43801. Built from https://develop.svn.wordpress.org/trunk@61639 git-svn-id: http://core.svn.wordpress.org/trunk@60950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…duplicate entries. This harmonizes and clarifies the documentation for the `$args` parameter in `wp_schedule_event()`, `wp_schedule_single_event()`, `wp_reschedule_event()`, `wp_unschedule_event()`, `wp_clear_scheduled_hook()`, and `wp_next_scheduled()`, to emphasize the requirement for matching arguments and the risks of mismatching them. Developed in WordPress#10890 Props manishxdp, westonruter, ovidiul, digamberpradhan. Fixes #43801. git-svn-id: https://develop.svn.wordpress.org/trunk@61639 602fd350-edb4-49c9-b593-d223f7449a82
Summary
Improves inline documentation for
wp_schedule_event()andwp_next_scheduled()to clarify that the$argsparameter is part of the unique identifier for scheduled cron events.Problem
If developers schedule an event with arguments but later check for existing events without passing the same arguments, WordPress treats them as different events. This can result in duplicate cron entries being created on every page load, potentially causing excessive growth of the
cronoption and database performance issues.Solution
This patch enhances the DocBlocks for both functions to:
Notes
This is a documentation-only change. No functional behavior is modified.
Trac Ticket
https://core.trac.wordpress.org/ticket/43801