[wp-hackers] Detecting which action ran function
Jackson Whelan
jw at jacksonwhelan.com
Fri Aug 12 15:03:35 UTC 2011
I think you may want to look at the global $wp_current_filter which is
set in the do_action() [1] function according to what action is being
called.
Alternatively you could create wrapper functions for each action, and
use them to pass a variable to your main function which would determine
the output.
Hope that helps,
Jackson
[1] http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/plugin.php
On 8/12/11 10:36 AM, Robert Lusby wrote:
> I have a function that is called from a number of different actions.
>
> The function does essentially the same, except for one small
> difference on output depending which action triggered it.
>
> How do you detect which WP action has called the function?
>
> Thanks,
> Rob
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list