WordPress.org

Make WordPress Core

Opened 18 months ago

Last modified 5 months ago

#42834 new defect (bug)

Doc mismatch between developer. and codex., codex appears to be more correct

Reported by: kluny 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)

#1 @joemcgill
18 months ago

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.

#2 @dingo_bastard
18 months ago

Also codex seems to be no longer maintained. All the relevant information should be found on developers page :)

Although, someone should update the wpdb developers page to be like the one for WP_Query().

#3 @pento
5 months ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.