Template Editor

The Template Editor allows you to edit and create templates, using blocks. These templates control the look and feel of the posts, pages, or page types on your site.

The Template Editor is only available if your site is using a block theme or a classic theme that has enabled the Template Editor on the backend.

About Templates

WordPress uses templates to create the layout and structure for posts, pages, or specific page types on your site page. There are a few base templates that are generated when you select a theme. For example:

  • The Home template is used to display the site’s home page if your site is set up to display the latest posts on the home page.
  • The Index template is used to display the index page of all the blog posts.
  • The Page template is used to display the site’s pages if no specific templates are assigned to the page.
  • Many block themes offer other built-in templates like the Single Post template to customize the layout of single blog posts, the 404 template to customize the layout of the 404 error page, the Search template to customize the layout of the search results page, and the Archive template for categories/archives page, etc.

Your block theme may come bundled with custom templates as well.

In the Template Editor, you can find all the templates on your site, including the custom templates you created and the ones that came bundled with your theme. You can edit these templates and create custom layouts using blocks.

What you need, to use the Template Editor

To work with the Template Editor, you need a block theme with WordPress 5.9 or later on your site or a classic theme that has enabled the Template Editor on the backend.

A block theme is a theme that uses blocks for all parts of a site, including navigation menus, header, content, and site footer.  All blocks that are available in the WordPress Block Editor can be used in the Template Editor. A set of blocks called Theme blocks are specifically built for the Site Editor and Template Editor.

You can find block themes in the WordPress theme directory by selecting Full Site Editing in the feature filter:

How to find a block theme
How to find a block theme

Two ways to access the Template Editor

There are two different ways you can access the Template Editor depending on what type of theme you are using:

  • If you are using a block theme, you can access the Template Editor when editing posts or pages via the WordPress Block Editor and also via the Site Editor.
  • If you are using a classic theme that has enabled the Template Editor on the backend, you can access the Template Editor only when editing posts or pages via the WordPress Block Editor.

How to use the Template Editor via the WordPress Block Editor

To use the Template Editor via the WordPress Block Editor, make sure your site is using a block theme or a classic theme that has enabled the Template Editor on the backend.

To edit a template

  1. Click Posts > Add New to add a new post or Pages > Add New to add a new page.
  2. This opens the WordPress Block Editor.
  3. Navigate to the Post/Page Settings sidebar tab.
  4. Under the ‘Template’ section, select ‘Edit’.
Edit template in Template Editor
Edit template in Template Editor

Edit option is only available if you are using a block theme that lets you edit custom templates.

  1. This opens the Template Editor and takes you to the template editing mode where you can make changes to the selected template. To go back to the WordPress Block Editor and continue making content changes, click the ‘Back’ link at the top left corner.
Back link in the Template Editor
Back link in the Template Editor
  1. When you’re done making changes, select ‘Publish’. This will prompt you to save all the changes you made including the template and the post or page.
  2. Click ‘Save to confirm the changes.
Saving template and the post/page
Saving template and the post/page

When you make changes to a template, the editor updates the blocks on all pages/posts that use the template.

To create a new custom template

  1. Click Posts > Add New to add a new post or Pages > Add New to add a new page.
  2. This opens the WordPress Block Editor.
  3. Navigate to the Post/Page Settings sidebar tab.
  4. Under the ‘Template’ section, select ‘New’.
Create template in Template Editor
Create template in Template Editor

The ‘New’ option is only available if you are using a block theme that lets you create custom templates.

  1. This opens a dialog box where you can give a name for the custom template you are about to create. Make sure to give it a descriptive name that describes the purpose of the template e.g. “Full Width”.
  2. Click ‘Create’ to open the Template Editor and go to the template editing mode where you can build the custom template using blocks. To go back to the WordPress Block Editor and continue making content changes, click the ‘Back’ link at the top left corner.
Back link in the Template Editor
Back link in the Template Editor
  1. When you’re done making changes, select ‘Publish’. This will prompt you to save all the changes you made including the template and the post or page.
  2. Click ‘Save to confirm the changes.
Saving template and the post/page
Saving template and the post/page

How to use the Template Editor via the Site Editor

To navigate to templates

  • Go to Appearance > Editor (beta) to open the Site Editor. You will be taken to the template of your home page (based on what you have set in the Reading Settings) and you can start editing this template.
  • To view the list of templates available for your site and switch between templates:
    • Click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
    • Click on ‘Templates’ to view the list of templates.
    • Click on any template name from the list to switch to that template.

To edit a template

  • From the Site Editor (Appearance > Editor (beta) ), click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
  • Click on ‘Templates’ to view the list of templates on your site, including any you have created and any that come with your theme.
  • Click on any of the templates in the list to edit the template. From here you can customize the layout of the selected template using blocks.
Editing Templates in the Site Editor
Editing Templates in the Site Editor
  • When you are done with the template customization, click ‘Save’.

When you make changes to a template, the editor updates the blocks on all pages/posts that use the template.

Save the template
Save the template
  • To go back to the Site Editor, click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation and click ‘Site’.
Going back to Site Editor from Template Editor
Going back to Site Editor from Template Editor

To add a new template

The Site Editor displays the limited number of template choices that you can add to your site. Custom templates cannot be created from the Site Editor. For this, you have to use the Template Editor via the WordPress Block Editor.

  • From the Appearance > Editor (beta), click the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
  • Click ‘Templates’ to view the list of templates on the site.
Accessing Templates in the Site Editor
Accessing Templates in the Site Editor
  • Click ‘Add New’ button in the top right corner to show a drop-down menu with a list of all new templates you can add to your site.
    • Front Page – to display the home page of your site if your site is set up to display a regular page for the home page.
    • Author – to display all the posts written by a single author.
    • Category – to display the posts in a category.
    • Date – to display the posts on the specific date.
    • Tag – to display posts based on a tag.
    • Taxonomy – to display posts from a specific taxonomy term.
Add new templates
Add new templates

How to assign a template to a post or page

  1. From the WordPress Dashboard, open the post or page that you want to assign the template.
  2. This opens the WordPress Block Editor.
  3. Navigate to the Post/Page Settings sidebar tab.
  4. Under the “Template” section, you’ll see a dropdown with a list of the templates available for your site. If you don’t see a dropdown option under ‘Template’ section, it means your site has not templates created and you need to create new templates.
  5. Pick the template you want to assign to the post or page.

Changing a page’s template affects that page only (not your entire site.)

How to rename custom templates

You can only rename custom templates that you created via the WordPress Block Editor.

There are two ways you can rename custom templates:

OPTION 1:

  • From the Site Editor (Appearance > Editor (beta) ), click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
  • Click on ‘Templates’ to view the list of templates on your site.
  • Click on any of the custom templates you created via the WordPress Block Editor.
  • In the Template Editor, click the down arrow next to the name of the Template in the top bar. This opens a drop down menu where you can type in a new name for the custom template you selected. Make sure the name indicates the purpose for the template eg: Full Width.
Renaming a custom template
Renaming a custom template
  • When you are done, click ‘Save’ in the top bar to save the custom template with the new name.
Saving custom template with the new name
Saving custom template with the new name

OPTION 2:

  • From the Site Editor (Appearance > Editor (beta) ), click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
  • Click on ‘Templates’ to view the list of templates on your site.
  • Click the three-dot menu icon on any of the custom templates you created via the WordPress Block Editor. From the drop-down menu and select ‘Rename’.
  • This will open a dialog box where you can type in a new name for the custom template you selected. Make sure the name indicates the purpose for the template eg: Full Width.
  • Click ‘Save’ to save the custom template with the new name.
Renaming custom template
Renaming custom template

This option is only available for the custom templates that you created via the WordPress Block Editor.

Clear customizations to templates in your block theme

When changes are made to templates that came bundled with your block theme, you will see the option to clear customizations.

Click the three-dot menu icon to open a drop-down menu and select ‘Clear customizations’. This will reset the template to the default state and you will lose the changes you made to that template.

Clear customizations for Template
Clear customizations for Template

This option is only available for the templates that you have already customized. If you don’t find this option, it means your template is already in its default state.

An easy way to identify the templates you have customized is to look for the blue dot next to the template icon in the ‘Added by’ column, in the list of templates.

The blue dot that indicates the templates you customized
The blue dot that indicates the templates you customized

Hovering over the blue template will also show a tooltip that indeicates the template has been customized.

The tooltip that indicates the templates you customized
The tooltip that indicates the templates you customized

How to delete a template

You can only delete the custom templates that you created via the WordPress Block Editor and the new templates you added via the Site Editor.

  • From the Site Editor (Appearance > Editor (beta) ), click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
  • Click on ‘Templates’ to view the list of templates on your site.
  • Click the three-dot menu icon on any of the custom templates you created via the WordPress Block Editor and and the new templates you added via the Site Editor. From the drop-down menu and select ‘Delete’. This will delete the template.
Delete a template
Delete a template

How to know that you’re editing a template

There are three ways to know you’re editing a template rather than your post or page:

  1. The welcome guide introduces you to this feature upon opening the Template Editor for the first time.
Image showing a welcome guide with text introducing the template editor.
Welcome guide for the template editor

2. The dark frame that appears around the template as you’re editing.

Image showing what the template editor looks like upon entering it, including the darker background framing the editor.
The dark frame when editing templates

3. The template name visible in the Top Bar

Template Editor showing the template name
Template Editor showing the template name