WordPress.org

Make WordPress Core

Opened 2 weeks ago

#50734 new enhancement

Document common values for hook names that contain dynamic portions

Reported by: johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Plugins Keywords: 2nd-opinion
Focuses: docs Cc:

Description

The names of many hooks in WordPress core contain a dynamic portion, for example manage_{$post->post_type}_posts_custom_column.

This can make it is difficult for developers to find the documentation relating to such a hook. For example, searching the Developer Resources site for `manage_page_posts_custom_column` returns no results despite it being a valid hook name. I've seen this happen in practice when working with both new and seasoned developers.

A few hooks include documentation which lists possible values, which allows them to appear in search results on the dev site. For example searching for `load-post-new.php` correctly shows the documentation for the load-{$pagenow} hook.

We should formalise this sort of documentation of potential values for dynamic hook names in order to make it easier for developers to find documentation. This won't be exhaustive of course, but it can cover common values.

There was some discussion on #37748 about doing this, but it didn't go anywhere.

Ideally these potential hook names would be list in a dedicated tag (eg. @hook) so that developer tools that work with the docs can understand them.

 * @hook manage_page_posts_custom_column
 * @hook manage_post_posts_custom_column
 * @hook manage_attachment_posts_custom_column
 */
do_action( "manage_{$post->post_type}_posts_custom_column" );

Thoughts?

Change History (0)

Note: See TracTickets for help on using tickets.