chore: fix hook registration type mismatches#11204
chore: fix hook registration type mismatches#11204apermo wants to merge 3 commits intoWordPress:trunkfrom
Conversation
|
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. |
Change add_filter() to add_action() for the admin_print_styles hook which is fired via do_action(). Related to https://core.trac.wordpress.org/ticket/64828
Change add_filter() to add_action() for the login_head hook which is fired via do_action(). Related to https://core.trac.wordpress.org/ticket/64828
Change add_action() to add_filter() for the use_block_editor_for_post_type hook which is fired via apply_filters(). Related to https://core.trac.wordpress.org/ticket/64828
26fec3b to
d89ccf8
Compare
Summary
Fixes 3 cases where hooks are registered with the wrong function —
add_action()used on a filter oradd_filter()used on an action. Functionally equivalent (sinceadd_action()callsadd_filter()internally), but semantically incorrect.add_filter()→add_action()(hook is fired viado_action()):admin_print_stylesinwp-admin/includes/admin-filters.phplogin_headinwp-includes/default-filters.phpadd_action()→add_filter()(hook is fired viaapply_filters()):use_block_editor_for_post_typeinwp-admin/includes/admin-filters.phpA 4th mismatch (
get_block_type_variationsusingadd_action()on a filter) originates in the Gutenberg repo and is tracked separately: WordPress/gutenberg#76296For detailed investigation notes, see: https://github.com/apermo/wordpress-develop/milestone/4
Trac ticket: https://core.trac.wordpress.org/ticket/64828
Use of AI Tools
Research (systematic cross-referencing of all
add_action/add_filterregistrations against theirdo_action/apply_filterscall sites) and code were produced by Claude Code (claude-sonnet-4-6). The contributor reviewed the findings, verified each fix, and approved the final implementation.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.