Tribe__Tickets__Editor__Meta::filter_rest_dispatch_request( mixed $dispatch_result, WP_REST_Request $request, string $route )

Hook into the REST API request dispatch process (before REST endpoint runs) for custom overrides.


Parameters #

$dispatch_result

(mixed) (Required) Dispatch result, will be used if not empty.

$request

(WP_REST_Request) (Required) Request used to generate the response.

$route

(string) (Required) Route matched for the request.


Top ↑

Return #

(mixed) Unmodified dispatch result.


Top ↑

Source #

File: src/Tribe/Editor/Meta.php

	public function filter_rest_dispatch_request( $dispatch_result, $request, $route ) {
		// Only disable meta updates from the normal WP endpoints for post/meta.
		if ( 0 !== strpos( $route, '/wp/' ) ) {
			return $dispatch_result;
		}

		// Don't get virtual meta.
		add_filter(
			'get_post_metadata',
			[ $this, 'register_tickets_list_in_rest' ],
			15,
			4
		);

		// Don't delete virtual meta.
		add_filter(
			'delete_post_metadata',
			[ $this, 'delete_tickets_list_in_rest' ],
			15,
			3
		);

		// Don't update virtual meta.
		add_filter(
			'update_post_metadata',
			[ $this, 'update_tickets_list_in_rest' ],
			15,
			3
		);

		// Don't update global stock meta.
		add_filter(
			'update_post_metadata',
			[ $this, 'update_global_stock_meta_in_rest' ],
			15,
			3
		);

		return $dispatch_result;
	}

Top ↑

Changelog #

Changelog
Version Description
4.11.5 Introduced.