<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[49103] trunk: REST API: Introduce search term handler.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/49103">49103</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/49103","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>TimothyBlynJacobs</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-10-08 01:30:25 +0000 (Thu, 08 Oct 2020)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>REST API: Introduce search term handler.

This allows for clients to search the available terms via the `/wp/v2/search` endpoint by using a `type=term` query parameter.

Fixes <a href="https://core.trac.wordpress.org/ticket/51458">#51458</a>.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesrestapiphp">trunk/src/wp-includes/rest-api.php</a></li>
<li><a href="#trunksrcwpsettingsphp">trunk/src/wp-settings.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestsearchcontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-search-controller.php</a></li>
<li><a href="#trunktestsqunitfixtureswpapigeneratedjs">trunk/tests/qunit/fixtures/wp-api-generated.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesrestapisearchclasswpresttermsearchhandlerphp">trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesrestapisearchclasswpresttermsearchhandlerphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php                               (rev 0)
+++ trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php 2020-10-08 01:30:25 UTC (rev 49103)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,154 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * REST API: WP_REST_Term_Search_Handler class
+ *
+ * @package WordPress
+ * @subpackage REST_API
+ * @since 5.6.0
+ */
+
+/**
+ * Core class representing a search handler for terms in the REST API.
+ *
+ * @since 5.6.0
+ *
+ * @see WP_REST_Search_Handler
+ */
+class WP_REST_Term_Search_Handler extends WP_REST_Search_Handler {
+
+       /**
+        * Constructor.
+        *
+        * @since 5.6.0
+        */
+       public function __construct() {
+               $this->type = 'term';
+
+               $this->subtypes = array_values(
+                       get_taxonomies(
+                               array(
+                                       'public'       => true,
+                                       'show_in_rest' => true,
+                               ),
+                               'names'
+                       )
+               );
+       }
+
+       /**
+        * Searches the object type content for a given search request.
+        *
+        * @since 5.6.0
+        *
+        * @param WP_REST_Request $request Full REST request.
+        * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing
+        *               an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the
+        *               total count for the matching search results.
+        */
+       public function search_items( WP_REST_Request $request ) {
+               $taxonomies = $request[ WP_REST_Search_Controller::PROP_SUBTYPE ];
+               if ( in_array( WP_REST_Search_Controller::TYPE_ANY, $taxonomies, true ) ) {
+                       $taxonomies = $this->subtypes;
+               }
+
+               $page     = (int) $request['page'];
+               $per_page = (int) $request['per_page'];
+
+               $query_args = array(
+                       'taxonomy'   => $taxonomies,
+                       'hide_empty' => false,
+                       'offset'     => ( $page - 1 ) * $per_page,
+                       'number'     => $per_page,
+               );
+
+               if ( ! empty( $request['search'] ) ) {
+                       $query_args['search'] = $request['search'];
+               }
+
+               /**
+                * Filters the query arguments for a search request.
+                *
+                * Enables adding extra arguments or setting defaults for a term search request.
+                *
+                * @param array           $query_args Key value array of query var to query value.
+                * @param WP_REST_Request $request    The request used.
+                */
+               $query_args = apply_filters( 'rest_term_search_query', $query_args, $request );
+
+               $query       = new WP_Term_Query();
+               $found_terms = $query->query( $query_args );
+               $found_ids   = wp_list_pluck( $found_terms, 'term_id' );
+
+               unset( $query_args['offset'], $query_args['number'] );
+
+               $total = wp_count_terms( $query_args );
+
+               // wp_count_terms() can return a falsey value when the term has no children.
+               if ( ! $total ) {
+                       $total = 0;
+               }
+
+               return array(
+                       self::RESULT_IDS   => $found_ids,
+                       self::RESULT_TOTAL => $total,
+               );
+       }
+
+       /**
+        * Prepares the search result for a given ID.
+        *
+        * @since 5.6.0
+        *
+        * @param int   $id     Item ID.
+        * @param array $fields Fields to include for the item.
+        * @return array Associative array containing all fields for the item.
+        */
+       public function prepare_item( $id, array $fields ) {
+               $term = get_term( $id );
+
+               $data = array();
+
+               if ( in_array( WP_REST_Search_Controller::PROP_ID, $fields, true ) ) {
+                       $data[ WP_REST_Search_Controller::PROP_ID ] = (int) $id;
+               }
+               if ( in_array( WP_REST_Search_Controller::PROP_TITLE, $fields, true ) ) {
+                       $data[ WP_REST_Search_Controller::PROP_TITLE ] = $term->name;
+               }
+               if ( in_array( WP_REST_Search_Controller::PROP_URL, $fields, true ) ) {
+                       $data[ WP_REST_Search_Controller::PROP_URL ] = get_term_link( $id );
+               }
+               if ( in_array( WP_REST_Search_Controller::PROP_TYPE, $fields, true ) ) {
+                       $data[ WP_REST_Search_Controller::PROP_TYPE ] = $term->taxonomy;
+               }
+
+               return $data;
+       }
+
+       /**
+        * Prepares links for the search result of a given ID.
+        *
+        * @since 5.6.0
+        *
+        * @param int $id Item ID.
+        * @return array Links for the given item.
+        */
+       public function prepare_item_links( $id ) {
+               $term = get_term( $id );
+
+               $links = array();
+
+               $item_route = rest_get_route_for_term( $term );
+               if ( $item_route ) {
+                       $links['self'] = array(
+                               'href'       => rest_url( $item_route ),
+                               'embeddable' => true,
+                       );
+               }
+
+               $links['about'] = array(
+                       'href' => rest_url( sprintf( 'wp/v2/taxonomies/%s', $term->taxonomy ) ),
+               );
+
+               return $links;
+       }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/wp-includes/rest-api/search/class-wp-rest-term-search-handler.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpincludesrestapiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api.php        2020-10-08 01:19:10 UTC (rev 49102)
+++ trunk/src/wp-includes/rest-api.php  2020-10-08 01:30:25 UTC (rev 49103)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -268,6 +268,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $controller = new WP_REST_Comments_Controller;
</span><span class="cx" style="display: block; padding: 0 10px">        $controller->register_routes();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $search_handlers = array(
+               new WP_REST_Post_Search_Handler(),
+               new WP_REST_Term_Search_Handler(),
+       );
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Filters the search handlers to use in the REST search controller.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -277,7 +282,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *                               handler instance must extend the `WP_REST_Search_Handler` class.
</span><span class="cx" style="display: block; padding: 0 10px">         *                               Default is only a handler for posts.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $search_handlers = apply_filters( 'wp_rest_search_handlers', array( new WP_REST_Post_Search_Handler() ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $search_handlers = apply_filters( 'wp_rest_search_handlers', $search_handlers );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $controller = new WP_REST_Search_Controller( $search_handlers );
</span><span class="cx" style="display: block; padding: 0 10px">        $controller->register_routes();
</span></span></pre></div>
<a id="trunksrcwpsettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-settings.php 2020-10-08 01:19:10 UTC (rev 49102)
+++ trunk/src/wp-settings.php   2020-10-08 01:30:25 UTC (rev 49103)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -266,6 +266,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-user-meta-fields.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/search/class-wp-rest-search-handler.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/rest-api/search/class-wp-rest-post-search-handler.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require ABSPATH . WPINC . '/rest-api/search/class-wp-rest-term-search-handler.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/sitemaps.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-index.php';
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestsearchcontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-search-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-search-controller.php     2020-10-08 01:19:10 UTC (rev 49102)
+++ trunk/tests/phpunit/tests/rest-api/rest-search-controller.php       2020-10-08 01:30:25 UTC (rev 49103)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,6 +35,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">        private static $my_content_post_ids = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Categories.
+        *
+        * @var int
+        */
+       private static $my_category_id;
+
+       /**
+        * Tags.
+        *
+        * @var int
+        */
+       private static $my_tag_id;
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Create fake data before our tests run.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param WP_UnitTest_Factory $factory Helper that lets us create fake data.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -62,6 +76,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'post_content' => 'my-foocontent',
</span><span class="cx" style="display: block; padding: 0 10px">                        )
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               self::$my_category_id = $factory->term->create(
+                       array(
+                               'taxonomy' => 'category',
+                               'name'     => 'Test Category',
+                       )
+               );
+
+               self::$my_tag_id = $factory->term->create(
+                       array(
+                               'taxonomy' => 'post_tag',
+                               'name'     => 'Test Tag',
+                       )
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -77,6 +105,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( $post_ids as $post_id ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        wp_delete_post( $post_id, true );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               $term_ids = array(
+                       self::$my_category_id,
+                       self::$my_tag_id,
+               );
+
+               foreach ( $term_ids as $term_id ) {
+                       wp_delete_term( $term_id, true );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -515,6 +552,158 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Search through terms of any type.
+        *
+        * @ticket 51458
+        */
+       public function test_get_items_search_type_term() {
+               $response = $this->do_request_with_params(
+                       array(
+                               'per_page' => 100,
+                               'type'     => 'term',
+                       )
+               );
+               $this->assertEquals( 200, $response->get_status() );
+               $this->assertEqualSets(
+                       array(
+                               0 => 1, // That is the default category.
+                               self::$my_category_id,
+                               self::$my_tag_id,
+                       ),
+                       wp_list_pluck( $response->get_data(), 'id' )
+               );
+       }
+
+       /**
+        * Search through terms of subtype 'category'.
+        *
+        * @ticket 51458
+        */
+       public function test_get_items_search_type_term_subtype_category() {
+               $response = $this->do_request_with_params(
+                       array(
+                               'per_page' => 100,
+                               'type'     => 'term',
+                               'subtype'  => 'category',
+                       )
+               );
+
+               $this->assertEquals( 200, $response->get_status() );
+               $this->assertEqualSets(
+                       array(
+                               0 => 1, // That is the default category.
+                               self::$my_category_id,
+                       ),
+                       wp_list_pluck( $response->get_data(), 'id' )
+               );
+       }
+
+       /**
+        * Search through posts of an invalid post type.
+        *
+        * @ticket 51458
+        */
+       public function test_get_items_search_term_subtype_invalid() {
+               $response = $this->do_request_with_params(
+                       array(
+                               'per_page' => 100,
+                               'type'     => 'term',
+                               'subtype'  => 'invalid',
+                       )
+               );
+
+               $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
+       }
+
+       /**
+        * Search through posts and pages.
+        *
+        * @ticket 51458
+        */
+       public function test_get_items_search_categories_and_tags() {
+               $response = $this->do_request_with_params(
+                       array(
+                               'per_page' => 100,
+                               'type'     => 'term',
+                               'subtype'  => 'category,post_tag',
+                       )
+               );
+               $this->assertEquals( 200, $response->get_status() );
+               $this->assertEqualSets(
+                       array(
+                               0 => 1, // This is the default category.
+                               self::$my_category_id,
+                               self::$my_tag_id,
+                       ),
+                       wp_list_pluck( $response->get_data(), 'id' )
+               );
+       }
+
+       /**
+        * Search through all that matches a 'Test Category' search.
+        *
+        * @ticket 51458
+        */
+       public function test_get_items_search_for_test_category() {
+               $response = $this->do_request_with_params(
+                       array(
+                               'per_page' => 100,
+                               'search'   => 'Test Category',
+                               'type'     => 'term',
+                       )
+               );
+
+               $this->assertEquals( 200, $response->get_status() );
+               $this->assertEqualSets(
+                       array(
+                               self::$my_category_id,
+                       ),
+                       wp_list_pluck( $response->get_data(), 'id' )
+               );
+       }
+
+       /**
+        * Search through all that matches a 'Test Tag' search.
+        *
+        * @ticket 51458
+        */
+       public function test_get_items_search_for_test_tag() {
+               $response = $this->do_request_with_params(
+                       array(
+                               'per_page' => 100,
+                               'search'   => 'Test Tag',
+                               'type'     => 'term',
+                       )
+               );
+
+               $this->assertEquals( 200, $response->get_status() );
+               $this->assertEqualSets(
+                       array(
+                               self::$my_tag_id,
+                       ),
+                       wp_list_pluck( $response->get_data(), 'id' )
+               );
+       }
+
+       /**
+        * Searching for a term that doesn't exist should return an empty result.
+        *
+        * @ticket 51458
+        */
+       public function test_get_items_search_for_missing_term() {
+               $response = $this->do_request_with_params(
+                       array(
+                               'per_page' => 100,
+                               'search'   => 'Doesn\'t exist',
+                               'type'     => 'term',
+                       )
+               );
+
+               $this->assertEquals( 200, $response->get_status() );
+               $this->assertEmpty( $response->get_data() );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Perform a REST request to our search endpoint with given parameters.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        private function do_request_with_params( $params = array(), $method = 'GET' ) {
</span></span></pre></div>
<a id="trunktestsqunitfixtureswpapigeneratedjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/fixtures/wp-api-generated.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/fixtures/wp-api-generated.js    2020-10-08 01:19:10 UTC (rev 49102)
+++ trunk/tests/qunit/fixtures/wp-api-generated.js      2020-10-08 01:30:25 UTC (rev 49103)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4413,7 +4413,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                             "required": false,
</span><span class="cx" style="display: block; padding: 0 10px">                             "default": "post",
</span><span class="cx" style="display: block; padding: 0 10px">                             "enum": [
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                "post"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                "post",
+                                "term"
</ins><span class="cx" style="display: block; padding: 0 10px">                             ],
</span><span class="cx" style="display: block; padding: 0 10px">                             "description": "Limit results to items of an object type.",
</span><span class="cx" style="display: block; padding: 0 10px">                             "type": "string"
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4427,6 +4428,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                 "enum": [
</span><span class="cx" style="display: block; padding: 0 10px">                                     "post",
</span><span class="cx" style="display: block; padding: 0 10px">                                     "page",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                    "category",
+                                    "post_tag",
</ins><span class="cx" style="display: block; padding: 0 10px">                                     "any"
</span><span class="cx" style="display: block; padding: 0 10px">                                 ],
</span><span class="cx" style="display: block; padding: 0 10px">                                 "type": "string"
</span></span></pre>
</div>
</div>

</body>
</html>