WP_REST_Plugins_Controller::does_plugin_match_request()
Checks if the plugin matches the requested parameters.
Метод класса: WP_REST_Plugins_Controller{}
Хуков нет.
Возвращает
true|false
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->does_plugin_match_request( $request, $item );
- $request(WP_REST_Request) (обязательный)
- The request to require the plugin matches against.
- $item(массив) (обязательный)
- The plugin item.
Список изменений
С версии 5.5.0 | Введена. |
Код WP_REST_Plugins_Controller::does_plugin_match_request() WP REST Plugins Controller::does plugin match request WP 6.2.2
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; }