Repository navigation
Don't fatal when invalid arguements are passed to wp_after_insert_post or after_delete_post. - #14356
aaronjorbin wants to merge 4 commits into
Conversation
…t or after_delete_post. Trac Ticket: https://core.trac.wordpress.org/ticket/64498#comment Props bradshawtm
|
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. |
…ility Cause: multisite hooks _update_posts_count_on_delete() onto after_delete_post too (src/wp-includes/ms-default-filters.php:78). It reads $post->post_status on string 'random' → warning → test error. Not our function's bug. Other core callbacks choking on junk are out of scope. Fix: tests now call wp_random_content_flush_rewrite_rules_for_post() directly instead of do_action(). Isolates unit under test from unrelated callbacks on same hook. Data provider renamed data_invalid_arguments, test test_invalid_arguments_do_not_flush_rewrite_rules. Same five cases, now keyed by value shape rather than hook name. _doing_it_wrong() still asserted on every case.
|
Thanks for working on this follow-up, @aaronjorbin! Removing the scalar and class type declarations on Testing this locally revealed a critical edge case regarding default parameters and
I've left inline code suggestions below for convenience! |
…onal post parameter and improve error handling for invalid arguments
Trac Ticket: https://core.trac.wordpress.org/ticket/64498#comment
Props bradshawtm
Use of AI Tools
AI assistance: Yes
Tool(s): Claude
Model(s): Fable 5.1
Used for: Initial code skeleton and test suggestions; final implementation and tests were reviewed and edited by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.