It is always global. add_filter()
and add_action()
are just wrapper for the global variable $wp_filter
. So it doesn’t matter where the function is called.
The same is true for apply_filters()
, apply_filters_ref_array()
, do_action_ref_array()
and do_action()
: they work in the global namespace, that’s the reason why the callback handlers (functions or methods) have to be public. A protected class method cannot be called from the global scope.