$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.


// 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"); 


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

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


selector (optional)string, array

Optional selector string to filter parents by.

Return value


All parent pages, or those matching the given selector.

$page methods and properties

API reference based on ProcessWire core version 3.0.137

Twitter updates

  • ProcessWire 3.0.146 on the dev branch contains about 22 commits with a combination of useful upgrades and issue report resolutions, more details in this forum post: More
    22 November 2019
  • ProcessWire 3.0.144 and 3.0.145 add improved field template context override settings and include a new Inputfields API, along with numerous other issue fixes, optimizations and improvements to the core. More
    8 November 2019
  • ProcessWire 3.0.144 core updates: Upgraded overrides section in the field editor, a new Inputfields JS API, and more— More
    1 November 2019

Latest news

  • ProcessWire Weekly #290
    In the 290th issue of ProcessWire Weekly we're going to introduce the latest addition to the ProDevTools module package and a third party image picker field from gebeer, check out a new site of the week, and more. Read on!
    Weekly.pw / 30 November 2019
  • New User Activity module
    Blog / 29 November 2019
  • Subscribe to weekly ProcessWire news

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull