Pass debug_backtrace() in WordPress filter
you can limit calls and ignore args like this to reduce performance: // Limit backtrace to last 3 calls as we don’t use the rest // Limit argument was introduced in PHP 5.4.0 $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);