WordPress.org

Making WordPress.org

Opened 6 months ago

Closed 6 months ago

#2880 closed defect (fixed)

Regex for @see linking of hooks recognize hook names contain variables

Reported by: coffee2code Owned by: coffee2code
Milestone: Priority: normal
Component: Developer Hub Keywords:
Cc:

Description

For example, in the description for wp_transition_comment_status() there is a reference to a hook that looks like this:

{@see 'comment_$new_status_$comment->comment_type'}

However, it fails to be recognized as a hook due to the presence of & and ; (that were introduced by the encoding of > to >) and the - that the regex in link_internal_element() doesn't expect. Thus, the resulting link is the fallback assumption that the reference is to a function.

(Note that as of this posting there is an unrelated bug that also affects the aforemention link, which will be addressed in #2881.)

Change History (1)

#1 @coffee2code
6 months ago

  • Owner set to coffee2code
  • Resolution set to fixed
  • Status changed from new to closed

In 5578:

developer.wordpress.org: Change regex for @see linking of hooks to recognize characters and HTML entities that may be present in hook names.

This is valid {@see 'comment_$new_status_$comment->comment_type'} but failed to be recognized as a hook due to the presence of & and ; (from the encoded value of >) and the -.

Example: https://developer.wordpress.org/reference/functions/wp_transition_comment_status/

Fixes #2880.

Note: See TracTickets for help on using tickets.