Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbw_trace_inspect_current no longer determines the current priority #63
Labels
Comments
This comment has been minimized.
This comment has been minimized.
Silly me. |
This comment has been minimized.
This comment has been minimized.
Closing this now that I've written a test for it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since WordPress 4.7.0 filters and hooks are now stored in the global
$wp_filter
as instances of classWP_hook
. The logic used to determine the current priority when tracing filter results no longer works.Expected output
when filter results to trace contains
we trace the results of the
the_content
filter at priority 1, 8, 9 and 9999 (default when value not set)This priority should be shown in the trace record that precedes the results.
Actual output
It shows
callbacks
, which is the name of the first field in the object.Proposed solution
WP_hook is implemented as a final class. The current_priority is a protected field.
We can get the value of a protected field by using Reflection functions.
We need to change
bw_trace_inspect_current()
to obtain the value of the current hookscurrent_priority
field, which is an array,It would have been easier to have a method to allow this inspection or just make the field public.
The solution does not need to check the WordPress version, as it's documented that it requires WordPress 4.9