WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 4 months ago

#39148 closed enhancement (fixed)

Correct concatenated dynamic hooks

Reported by: keesiemeijer Owned by: johnbillion
Milestone: 4.7.1 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: docs Cc:

Description

Cleaning up concatenated dynamic hooks as per the coding-standards

Related: #38462

Attachments (1)

39148.patch (10.0 KB) - added by keesiemeijer 5 months ago.
Use interpolation for naming of dynamic hooks

Download all attachments as: .zip

Change History (10)

@keesiemeijer
5 months ago

Use interpolation for naming of dynamic hooks

#1 @keesiemeijer
5 months ago

  • Keywords has-patch added

#2 @MaximeCulea
5 months ago

  • Component changed from General to Formatting
  • Keywords 2nd-opinion dev-feedback added
  • Version set to trunk

Hi @keesiemeijer,
It's a good idea, but that means cleaning a lot of current hooks :confused:
Moreover, I've heard that when formatting and/or coding standards are in, rather than applying to all curent application it's preferable to only apply on new tickets.

#3 @keesiemeijer
5 months ago

I understand, but the documentation in the code reference relies on the hook names to be correct. For a fun example look here: https://developer.wordpress.org/reference/hooks/handle_bulk_actions-get_current_screen-id/

Should I create separate tickets for all of them?

#4 @keesiemeijer
5 months ago

  • Component changed from Formatting to General

#5 @MaximeCulea
5 months ago

@keesiemeijer no need, but better wait for a core-team point of view ;)

#6 @johnbillion
5 months ago

  • Keywords 2nd-opinion dev-feedback removed
  • Milestone changed from Awaiting Review to 4.8
  • Version trunk deleted

Thanks for the patch, @keesiemeijer.

These dynamic hook names are indeed incorrect. Here's an example of where the hook name gets messed up on the code reference:

https://developer.wordpress.org/reference/hooks/handle_bulk_actions-get_current_screen-id/

#7 @ocean90
5 months ago

#39193 was marked as a duplicate.

#8 @johnbillion
4 months ago

  • Milestone changed from 4.8 to 4.7.1
  • Owner set to johnbillion
  • Status changed from new to reviewing
  • Summary changed from Clean up of concatenated dynamic hooks to Correct concatenated dynamic hooks

#9 @johnbillion
4 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 39600:

General: Use interpolation instead of concatenation for all dynamic hook names.

This fixes the rendering of the hook names on developer.wordpress.org.

Props keesiemeijer
Fixes #39148

Note: See TracTickets for help on using tickets.