[wp-trac] [WordPress Trac] #64018: Improve PHPDoc for template_redirect hook
WordPress Trac
noreply at wordpress.org
Mon Sep 22 14:55:15 UTC 2025
#64018: Improve PHPDoc for template_redirect hook
-------------------------+-----------------------------
Reporter: apermo | Owner: SergeyBiryukov
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.9
Component: Themes | Version: 1.5
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: docs
-------------------------+-----------------------------
Comment (by SergeyBiryukov):
Thanks for the ticket!
Replying to [ticket:64018 apermo]:
> The inline documentation of `template_redirect` is minimalistic at best
It is perhaps worth noting for future reference that this is actually
encouraged by the [https://developer.wordpress.org/coding-standards
/inline-documentation-standards/php/#4-hooks-actions-and-filters
documentation standards]:
> Summaries should be clear, simple, and brief. Avoid describing “why” an
element exists, rather, focus on documenting “what” and “when” it does
something.
> ...
> Actions: ''When'' does an action fire?
> * Good: ''Fires after most of core is loaded, and the user is
authenticated.''
> * Bad: ''Allows you to register custom post types, custom taxonomies,
and other general housekeeping tasks after a lot of WordPress core has
loaded.''
> ...
> Summary: A brief, one line explanation of the purpose of the hook. Use a
period at the end.
> Description: A supplemental description to the summary, if warranted.
However, I also noticed that some hooks do include an extended
description, e.g. `mce_external_plugins`, `exit_on_http_head`,
`enable_wp_debug_mode_checks`, etc. So [60791] adds that for
`template_redirect`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64018#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list