Wordpress snippet

How to exclude a page template from wp_list_pages

The `wp_list_pages` query is a great way to display your WordPress pages in list format as part of your WordPress theme template.

Sometimes you may want to exclude pages of a specific template type from the `wp_list_pages` query, for example a campaign landing page or password protected page.

To do this add the code snippet below to your WordPress theme template:

In this example, any pages that use the page-custom.php template are excluded from the `wp_list_pages` query.

Useful links:

If you would like to discuss this article or have any other queries regarding its contents please don’t hesitate to contact me.