WP_REST_Plugins_Controller::does_plugin_match_request( WP_REST_Request $request, array $item ): bool

In this article

Checks if the plugin matches the requested parameters.

Parameters

$requestWP_REST_Requestrequired
The request to require the plugin matches against.
$itemarrayrequired
The plugin item.

Return

bool

Source

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

	if ( $search ) {
		$matched_search = false;

		foreach ( $item as $field ) {
			if ( is_string( $field ) && str_contains( 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;
}

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.