Title: Template_Parts
Published: April 26, 2023
Last modified: October 14, 2026

---

# Template_Parts

## In this article

 * [Schema](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema)
 * [Retrieve a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#retrieve-a-template_part)
    - [Definition & Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-example-request)
    - [Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments)
 * [Create a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#create-a-template_part)
    - [Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-2)
    - [Definition](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition)
 * [Retrieve a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#retrieve-a-template_part-2)
    - [Definition & Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-example-request-2)
    - [Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-3)
 * [Update a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#update-a-template_part)
    - [Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-4)
    - [Definition](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-2)
    - [Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#example-request)
 * [Delete a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#delete-a-template_part)
    - [Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-5)
    - [Definition](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-3)
    - [Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#example-request-2)

## 󠀁[Schema](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema)󠁿

The schema defines all the fields that exist within a template_part 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`  |   ID of template.

 JSON data type: string

Read only

Context: `embed`, `view`, `edit`

  |  
 |   `slug`  |   Unique slug identifying the template.

 JSON data type: string

Context: `embed`, `view`, `edit`

  |  
 |   `theme`  |   Theme identifier for the template.

 JSON data type: string

Context: `embed`, `view`, `edit`

  |  
 |   `type`  |   Type of template.

 JSON data type: string

Context: `embed`, `view`, `edit`

  |  
 |   `source`  |   Source of template

 JSON data type: string

Read only

Context: `embed`, `view`, `edit`

  |  
 |   `origin`  |   Source of a customized template

 JSON data type: string

Read only

Context: `embed`, `view`, `edit`

  |  
 |   `content`  |   Content of template.

 JSON data type: object or string

Context: `embed`, `view`, `edit`

  |  
 |   `title`  |   Title of template.

 JSON data type: object or string

Context: `embed`, `view`, `edit`

  |  
 |   `description`  |   Description of template.

 JSON data type: string

Context: `embed`, `view`, `edit`

  |  
 |   `status`  |   Status of template.

 JSON data type: string

Context: `embed`, `view`, `edit`

 One of: `publish`, `future`, `draft`, `pending`, `private`

 |  
 |   `wp_id`  |   Post ID.

 JSON data type: integer

Read only

Context: `embed`, `view`, `edit`

  |  
 |   `has_theme_file`  |   Theme file exists.

 JSON data type: bool

Read only

Context: `embed`, `view`, `edit`

  |  
 |   `author`  |   The ID for the author of the template.

 JSON data type: integer

Context: `view`, `edit`, `embed`

  |  
 |   `modified`  |   The date the template was last modified, in the site’s timezone.

 JSON data type: string,
 Format: datetime ([details](https://core.trac.wordpress.org/ticket/41032))

Read only

Context: `view`, `edit`

  |  
 |   `area`  |   Where the template part is intended for use (header, footer, etc.)

 JSON data type: string

Context: `embed`, `view`, `edit`

  |

## 󠀁[Retrieve a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#retrieve-a-template_part)󠁿

### 󠀁[Definition & Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-example-request)󠁿

 `GET /wp/v2/template-parts`

 Query this endpoint to retrieve a specific template_part record.

 `$ curl https://example.com/wp-json/wp/v2/template-parts`

### 󠀁[Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments)󠁿

 |   `context`  |   Scope under which the request is made; determines fields present in response.

 Default: `view`

 One of: `view`, `embed`, `edit`

 |  
 |   `wp_id`  |   Limit to the specified post id.  |  
 |   `area`  |   Limit to the specified template part area.  |  
 |   `post_type`  |   Post type to get the templates for.  |

## 󠀁[Create a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#create-a-template_part)󠁿

### 󠀁[Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-2)󠁿

 |   `[slug](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-slug)`  |   Unique slug identifying the template.

 Required: 1

  |  
 |   `[theme](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-theme)`  |   Theme identifier for the template.  |  
 |   `[type](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-type)`  |   Type of template.  |  
 |   `[content](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-content)`  |   Content of template.  |  
 |   `[title](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-title)`  |   Title of template.  |  
 |   `[description](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-description)`  |   Description of template.  |  
 |   `[status](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-status)`  |   Status of template.

 Default: `publish`

 One of: `publish`, `future`, `draft`, `pending`, `private`

 |  
 |   `[author](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-author)`  |   The ID for the author of the template.  |  
 |   `[area](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-area)`  |   Where the template part is intended for use (header, footer, etc.)  |

### 󠀁[Definition](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition)󠁿

 `POST /wp/v2/template-parts`

## 󠀁[Retrieve a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#retrieve-a-template_part-2)󠁿

### 󠀁[Definition & Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-example-request-2)󠁿

 `GET /wp/v2/template-parts/<id>?)[\/\w%-]+)`

 Query this endpoint to retrieve a specific template_part record.

 `$ curl https://example.com/wp-json/wp/v2/template-parts/<id>?)[\/\w%-]+)`

### 󠀁[Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-3)󠁿

 |   `id`  |   The id of a template  |  
 |   `context`  |   Scope under which the request is made; determines fields present in response.

 Default: `view`

 One of: `view`, `embed`, `edit`

 |

## 󠀁[Update a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#update-a-template_part)󠁿

### 󠀁[Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-4)󠁿

 |   `[id](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-id)`  |   The id of a template  |  
 |   `[slug](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-slug)`  |   Unique slug identifying the template.  |  
 |   `[theme](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-theme)`  |   Theme identifier for the template.  |  
 |   `[type](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-type)`  |   Type of template.  |  
 |   `[content](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-content)`  |   Content of template.  |  
 |   `[title](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-title)`  |   Title of template.  |  
 |   `[description](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-description)`  |   Description of template.  |  
 |   `[status](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-status)`  |   Status of template.
 One of: `publish`, `future`, `draft`, `pending`, `private`  |  
 |   `[author](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-author)`  |   The ID for the author of the template.  |  
 |   `[area](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#schema-area)`  |   Where the template part is intended for use (header, footer, etc.)  |

### 󠀁[Definition](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-2)󠁿

 `POST /wp/v2/template-parts/<id>?)[\/\w%-]+)`

### 󠀁[Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#example-request)󠁿

## 󠀁[Delete a Template_Part](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#delete-a-template_part)󠁿

### 󠀁[Arguments](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#arguments-5)󠁿

 |   `id`  |   The id of a template  |  
 |   `force`  |   Whether to bypass Trash and force deletion.  |

### 󠀁[Definition](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#definition-3)󠁿

 `DELETE /wp/v2/template-parts/<id>?)[\/\w%-]+)`

### 󠀁[Example Request](https://developer.wordpress.org/rest-api/reference/wp_template_parts/?output_format=md#example-request-2)󠁿

 `$ curl -X DELETE https://example.com/wp-json/wp/v2/template-parts/<id>?)[\/\w%-]
+)`

First published

April 26, 2023

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: Template_Parts ](https://github.com/WP-API/docs/edit/master/reference/wp_template_parts.md)

Changelog

[ See list of changes: Template_Parts ](https://github.com/WP-API/docs/commits/master/reference/wp_template_parts.md)

[  Previous: Template_Part Revisions](https://developer.wordpress.org/rest-api/reference/wp_template_part-revisions/)

[  Next: Themes](https://developer.wordpress.org/rest-api/reference/themes/)