[wp-trac] [WordPress Trac] #37748: Dynamic Hooks Naming Convention

WordPress Trac noreply at wordpress.org
Sun Aug 21 00:23:36 UTC 2016


#37748: Dynamic Hooks Naming Convention
-------------------------+--------------------------------
 Reporter:  ramiy        |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  docs, performance
-------------------------+--------------------------------
Changes (by DrewAPicture):

 * status:  closed => reopened
 * resolution:  wontfix =>
 * milestone:   => Awaiting Review


Comment:

 Replying to [comment:1 peterwilsoncc]:
 > Current practice is for WordPress to avoid refactoring code for such
 cases as it makes it more difficult to see the history of the project.

 I actually think there's merit in ignoring the refactoring rule in this
 instance. Standardizing on interpolation or concatenation would be a good
 step toward improving these hooks' ability to self document.

 Typically, concatenation is going to be faster unless there's multiple
 parts, at which point the performance gain is largely negated by full
 concatenations happening for each successive part.

 Personally, I prefer interpolation simply because it's easier to read
 linearly, and we're all about self-documenting code here.

 As for whether they're a thing of the past, we introduced four new dynamic
 hooks in 4.6 alone ;)

 > Dynamically named hooks are also a thing of the past because they make
 searching more difficult for developers, as you say.

 I think with the introduction of dynamic hook aliases (probably in 4.7, if
 I can get my act together) will help a lot with search.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37748#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list