The schema defines all the fields that exist within a widget 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 widget. JSON data type: string Context: |
id_base
|
The type of the widget. Corresponds to ID in widget-types endpoint. JSON data type: string Context: |
sidebar
|
The sidebar the widget belongs to. JSON data type: string Context: |
rendered
|
HTML representation of the widget. JSON data type: string Read only Context: |
rendered_form
|
HTML representation of the widget admin form. JSON data type: string Read only Context: |
instance
|
Instance settings of the widget, if supported. JSON data type: object Context: |
form_data
|
URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only. JSON data type: string Context: |
</div>
<h3>Definition & Example Request</h3>
<code>GET /wp/v2/widgets</code>
<p>Query this endpoint to retrieve a specific widget record.</p>
<code>$ curl https://example.com/wp-json/wp/v2/widgets</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>, <code>edit</code></p>
</td>
</tr>
<tr>
<td>
<code>sidebar</code><br />
</td>
<td>
<p>The sidebar to return widgets for.</p>
</td>
</tr>
</table>
</div>
id |
Unique identifier for the widget. |
id_base |
The type of the widget. Corresponds to ID in widget-types endpoint. |
sidebar |
The sidebar the widget belongs to. Required: 1
Default: |
instance |
Instance settings of the widget, if supported. |
form_data |
URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only. |
</div>
<div class="secondary">
<h3>Definition</h3>
<code>POST /wp/v2/widgets</code>
</div>
<h3>Definition & Example Request</h3>
<code>GET /wp/v2/widgets/<id></code>
<p>Query this endpoint to retrieve a specific widget record.</p>
<code>$ curl https://example.com/wp-json/wp/v2/widgets/<id></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>, <code>edit</code></p>
</td>
</tr>
</table>
</div>
id |
Unique identifier for the widget. |
id_base |
The type of the widget. Corresponds to ID in widget-types endpoint. |
sidebar |
The sidebar the widget belongs to. |
instance |
Instance settings of the widget, if supported. |
form_data |
URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only. |
</div>
<div class="secondary">
<h3>Definition</h3>
<code>POST /wp/v2/widgets/<id></code>
<h3>Example Request</h3>
<code></code>
</div>
force |
Whether to force removal of the widget, or move it to the inactive sidebar. |
</div>
<div class="secondary">
<h3>Definition</h3>
<code>DELETE /wp/v2/widgets/<id></code>
<h3>Example Request</h3>
<code>$ curl -X DELETE https://example.com/wp-json/wp/v2/widgets/<id></code>
</div>