WordPress at a glance
function is not described

WP_REST_Plugins_Controller::does_plugin_match_request() protected WP 5.5.0

Checks if the plugin matches the requested parameters.

{} It's a method of the class: WP_REST_Plugins_Controller{}

No Hooks.

Return

true/false.

Usage

// protected - for code of main (parent) or child class
$result = $this->does_plugin_match_request( $request, $item );
$request(WP_REST_Request) (required)
The request to require the plugin matches against.
$item(array) (required)
The plugin item.

Changelog

Since 5.5.0 Introduced.

Code of WP_REST_Plugins_Controller::does_plugin_match_request() WP 5.5.1

<?php
protected function does_plugin_match_request( $request, $item ) {
	$search = $request['search'];

	if ( $search ) {
		$matched_search = false;

		foreach ( $item as $field ) {
			if ( is_string( $field ) && false !== strpos( strip_tags( $field ), $search ) ) {
				$matched_search = true;
				break;
			}
		}

		if ( ! $matched_search ) {
			return false;
		}
	}

	$status = $request['status'];

	if ( $status && ! in_array( $this->get_plugin_status( $item['_file'] ), $status, true ) ) {
		return false;
	}

	return true;
}