Skip to content

Latest commit

 

History

History
181 lines (172 loc) · 4.58 KB

search-results.md

File metadata and controls

181 lines (172 loc) · 4.58 KB


Search Results

Schema

The schema defines all the fields that exist within a search result record. Any response from these endpoints can be expected to contain the fields below unless the `_filter` query parameter is used or the schema field only appears in a specific context.

id

Unique identifier for the object.

JSON data type: integer or string

Read only

Context: view, embed

title

The title for the object.

JSON data type: string

Read only

Context: view, embed

url

URL to the object.

JSON data type: string, Format: uri

Read only

Context: view, embed

type

Object type.

JSON data type: string

Read only

Context: view, embed

One of: post, term, post-format

subtype

Object subtype.

JSON data type: string

Read only

Context: view, embed

One of: post, page, category, post_tag

</div>

List Search Results

Query this endpoint to retrieve a collection of search results. The response you receive can be controlled and filtered using the URL query parameters below.

	<h3>Definition</h3>

	<code>GET /wp/v2/search</code>

	<h3>Example Request</h3>

	<code>$ curl https://example.com/wp-json/wp/v2/search</code>
</div>
<div class="secondary">
		<h3>Arguments</h3>
<table class="arguments">
				<tr>
			<td>
										<code>context</code><br />
								</td>
			<td>
										<p>Scope under which the request is made; determines fields present in response.</p>
																				<p class="default">
						Default: <code>view</code>
					</p>
															<p>One of: <code>view</code>, <code>embed</code></p>
								</td>
		</tr>
				<tr>
			<td>
										<code>page</code><br />
								</td>
			<td>
										<p>Current page of the collection.</p>
																				<p class="default">
						Default: <code>1</code>
					</p>
													</td>
		</tr>
				<tr>
			<td>
										<code>per_page</code><br />
								</td>
			<td>
										<p>Maximum number of items to be returned in result set.</p>
																				<p class="default">
						Default: <code>10</code>
					</p>
													</td>
		</tr>
				<tr>
			<td>
										<code>search</code><br />
								</td>
			<td>
										<p>Limit results to those matching a string.</p>
																							</td>
		</tr>
				<tr>
			<td>
										<code>type</code><br />
								</td>
			<td>
										<p>Limit results to items of an object type.</p>
																				<p class="default">
						Default: <code>post</code>
					</p>
															<p>One of: <code>post</code>, <code>term</code>, <code>post-format</code></p>
								</td>
		</tr>
				<tr>
			<td>
										<code>subtype</code><br />
								</td>
			<td>
										<p>Limit results to items of one or more object subtypes.</p>
																				<p class="default">
						Default: <code>any</code>
					</p>
													</td>
		</tr>
				<tr>
			<td>
										<code>exclude</code><br />
								</td>
			<td>
										<p>Ensure result set excludes specific IDs.</p>
																							</td>
		</tr>
				<tr>
			<td>
										<code>include</code><br />
								</td>
			<td>
										<p>Limit result set to specific IDs.</p>
																							</td>
		</tr>
		</table>

</div>