WordPress.org

Make WordPress Core

Opened 16 months ago

Closed 9 months ago

#45360 closed feature request (wontfix)

Store and get hook args in WP_Hook

Reported by: hamedmoodi Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: Cc:

Description

Hi

I think it is good that developer have access to args hooks in WP_Hook objects in global $wp_filter.

I offer WP_Hook could be have 'public $args' and set args in do_action method.

Final developers has access to args for each hook for programming.

Thanks

Change History (3)

#1 @lonelyvegan
15 months ago

  • Milestone changed from Awaiting Review to Future Release

#2 @johnbillion
13 months ago

  • Keywords close added
  • Version 5.0 deleted

I'm not sure that this is something that belongs in core, because storing the arguments that are passed to hook callbacks can consume huge amounts of memory, particularly when object instances are being passed around. I've run into this problem in my Query Monitor plugin, which has to work very hard to minimise the amount of data that it stores to avoid consuming too much memory.

If you really need to access all the arguments passed to each hook, you can do it by attaching a callback to the all hook which logs them, but bear in mind it will quickly eat up memory.

#3 @desrosj
9 months ago

  • Keywords close removed
  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I tend to agree with @johnbillion. Going to close this out.

Note: See TracTickets for help on using tickets.