$page->parents() method

Return this page’s parent pages, or the parent pages matching the given selector.

This method returns all parents of this page, in order. If a selector is specified, they will be filtered by the selector. By default, parents are returned in breadcrumb order. In 3.0.158+ if you specify boolean true for selector argument, then it will return parents in reverse order (closest to furthest).


// Render breadcrumbs 
foreach($page->parents() as $parent) {
  echo "<li><a href='$parent->url'>$parent->title</a></li>";
// Return all parents, excluding the homepage
$parents = $page->parents("template!=home"); 
// Return parents in reverse order (closest to furthest, 3.0.158+)
$parents = $page->parents(true); 


// basic usage
$items = $page->parents();

// usage with all arguments
$items = $page->parents($selector = '');


selector (optional)string, array, bool

Optional selector string to filter parents by or boolean true for reverse order

Return value


All parent pages, or those matching the given selector.

$page methods and properties

API reference based on ProcessWire core version 3.0.185

Twitter updates

  • ProcessWire 3.0.187: This week we have some very useful new additions to both the core Repeater Fieldtype and the ProFields Repeater Matrix Fieldtype. This post covers all the details along with a couple of brief demonstration videos— More
    22 October 2021
  • ProcessWire 3.0.185 (dev) core updates, plus new Session Allow module— More
    17 September 2021
  • Three new ProcessWire Textformatter modules: Find/Replace, Markdown in Markup, and Emoji— More
    3 September 2021

Latest news

  • ProcessWire Weekly #388
    In the 388th issue of ProcessWire Weekly we'll check out the latest core update, introduce two new third party modules, and more. Read on!
    Weekly.pw / 16 October 2021
  • ProcessWire 3.0.184 new master/main version
    This week we have a new master/main version released after a full year in the making. As you might imagine, this new version has a ton of great new stuff and we’ll try to cover much of it here.
    Blog / 27 August 2021
  • Subscribe to weekly ProcessWire news

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer