# Filtering pages by page template

Page templates are stored in a custom field called `_wp_page_template` and can be chaged on the page editor screen.

<figure><img src="/files/jrkcTIuOOIRlhZT8RwTr" alt="" width="188"><figcaption></figcaption></figure>

### Filter by page template

To create any visual filter on the page templates, use the `_wp_page_template` custom field to create a custom field filter.

<figure><img src="/files/kyVeZ77f76GYtVSK6gIH" alt="" width="375"><figcaption><p>Page template filter</p></figcaption></figure>

### Restrict results to specific template

To make an invisible restriction, use a hidden type filter to restrict the results to a specific template.

{% hint style="info" %}
If you don't know the tempalte name, make a visual filter (Radio) with the {get\_values} pseudo variable, and the plugin will display the values in the preview. ↑See example above↑
{% endhint %}

<figure><img src="/files/7XWMGRZIcZJd00hJVlJc" alt="" width="375"><figcaption><p>Resticting results to a specific template</p></figcaption></figure>

### Exclude results by specific template

Similarly as on the previous example, using the hidden type filter and the "NOT EXACTLY LIKE" operator will exclude all pages matching the given value.

<figure><img src="/files/wuU9pNdJBwDjkFYIwf5a" alt="" width="375"><figcaption><p>Excluding results by a template</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.ajaxsearchpro.com/miscellaneous/post-types/filtering-pages-by-page-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
