WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана


Middleware::tap() public Yoast 1.0

Middleware that invokes a callback before and after sending a request.

The provided listener cannot modify or alter the response. It simply "taps" into the chain to be notified before returning the promise. The before listener accepts a request and options array, and the after listener accepts a request, options array, and response promise.

{} Это метод класса: Middleware{}

Хуков нет.


callable. Returns a function that accepts the next handler.


$result = Middleware::tap( $before, $after );
Function to invoke before forwarding the request.
По умолчанию: null
Function invoked after forwarding.
По умолчанию: null

Код Middleware::tap() Yoast 17.1

public static function tap(callable $before = null, callable $after = null)
    return function (callable $handler) use($before, $after) {
        return function ($request, array $options) use($handler, $before, $after) {
            if ($before) {
                $before($request, $options);
            $response = $handler($request, $options);
            if ($after) {
                $after($request, $options, $response);
            return $response;