[wp-trac] [WordPress Trac] #57097: `_add_template_loader_filters` uses `add_filter` instead of `add_action`

WordPress Trac noreply at wordpress.org
Mon Nov 14 07:55:13 UTC 2022


#57097: `_add_template_loader_filters` uses `add_filter` instead of `add_action`
--------------------------+----------------------------------------
 Reporter:  swissspidy    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  low           |  Milestone:  Future Release
Component:  Themes        |    Version:
 Severity:  normal        |   Keywords:  good-first-bug needs-patch
  Focuses:                |
--------------------------+----------------------------------------
 `_add_template_loader_filters`  uses `add_filter` to hook into
 `pre_get_posts`, which is an action hook and not a filter. Therefore,
 `add_action` should be used.

 Technically, both are identical under the hood, but especially for people
 new to the code base this could cause confusion.

 https://github.com/WordPress/wordpress-
 develop/blob/f404ff34c0ce1b9fab35635f6b92f299a1442c7f/src/wp-includes
 /block-template.php#L14-L32

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


More information about the wp-trac mailing list