[wp-trac] [WordPress Trac] #64828: add_filter() used on actions and add_action() used on filters in core

WordPress Trac noreply at wordpress.org
Sun Mar 8 15:49:40 UTC 2026


#64828: add_filter() used on actions and add_action() used on filters in core
--------------------------+-----------------------------
 Reporter:  apermo        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 Three cases in core where hooks are registered with the wrong function:

   * `add_filter( 'admin_print_styles', ... )` in `wp-admin/includes/admin-
 filters.php:56` — hook fires via `do_action()`
   * `add_filter( 'login_head', ... )` in `wp-includes/default-
 filters.php:388` — hook fires via `do_action()`
   * `add_action( 'use_block_editor_for_post_type', ... )` in `wp-
 admin/includes/admin-filters.php:88` — hook fires via `apply_filters()`

 A 4th case (`get_block_type_variations`) originates in Gutenberg:
 https://github.com/WordPress/gutenberg/issues/76296

 Functionally equivalent since `add_action()` calls `add_filter()`
 internally, but semantically incorrect.

 Found while working on #64224 (docblock improvements). Related to #64238
 (PHPStan catchall).

 PR: https://github.com/WordPress/wordpress-develop/pull/11204

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64828>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list