WordPress / WordPress/phpdoc-parser

Only add hooks that originate in the parsed source

Open
#45 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Someday Maybe
Dominant language
PHP
Stars
239
Forks
81
Avg merge
16h 29m
Merged PRs (30d)
8

Description

This might be outside the intended scope of this plugin, but I hope it will be considered anyway.

Let's take a basic action of a theme calling do_action( 'wp_head' ). Parsing the theme, this makes it look like the hook originated in this theme, when really it is defined elsewhere (in WP itself).

For those generating docs specifically for a plugin or theme, it might make sense to be able to add a tag (@externalhook?) to the hooks documentation that identifies that a hook originates outside of the source being parsed (and so ignore those hooks like how @internal works).

A child theme might do the same with hooks that are originally defined in the parent theme.

Also ping @drewapicture - any thoughts on something like this being suitable for a wider recommendation via the Handbook?

/**
 * @externalhook
 */
do_action( 'wp_head' );

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's example of do_action( 'wp_head' ) and compare the proposed @externalhook tag with the existing @internal behavior. Determine how hooks are identified in parsed source and define completion as excluding hooks marked as external, including hooks inherited from a parent theme.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.