Opened 3 years ago
Last modified 2 years ago
#42834 new defect (bug)
Doc mismatch between developer. and codex., codex appears to be more correct
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | |
Focuses: | Cc: |
Description
I’m looking at some code that uses the switch_theme hook. The docs are quite different between the (current)https://developer.wordpress.org/reference/hooks/switch_theme/ docs and the old (codex)https://codex.wordpress.org/Plugin_API/Action_Reference/switch_theme.
Specifically, the old version specified that switch_theme is best used for things that should happen when a theme is *deactivated*, and actions related to the new theme should be on after_switch_theme. The new docs don’t make the distinction, but the code hasn’t changed since like 4.5. I'm wonder whether developer.wordpress.org has the most correct info?
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hi @kluny,
The descriptions on https://developer.wordpress.org/ is automatically parsed from the inline docs in the code, which in this case can be found at https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/theme.php#L741. We could improve the online documentation by adding an additional description to the inline docs for this hook, in order to make the use more clear.
Alternately, user contributed notes can be added at the end of each documentation page. In this case, it looks like there is a user supplied example, which states "This hook is useful while deactivating a theme." While close, I don't think that clearly communicates "why" it's useful while deactivating a theme, so additional details would be helpful.