$pages->getPath() method

Given an ID, return a path to a page, without loading the actual page

  1. Always returns path in default language, unless a language argument/option is specified.
  2. Path may be different from 'url' as it doesn't include the root URL at the beginning.
  3. In most cases, it's preferable to use $page->path() rather than this method. This method is here just for cases where a path is needed without loading the page.
  4. It's possible for there to be Page::path() hooks, and this method completely bypasses them, which is another reason not to use it unless you know such hooks aren't applicable to you.

Available since version 3.0.6.


// Get the path for page having ID 1234
$path = $pages->getPath(1234);
echo "Path for page 1234 is: $path";


// basic usage
$string = $pages->getPath($id);

// usage with all arguments
$string = $pages->getPath($id, $options = []);


idint, Page

ID of the page you want the path to

options (optional)null, array, Language, int, string

Specify $options array or Language object, id or name. Allowed options include:

  • language (int|string|anguage): To retrieve in non-default language, specify language object, ID or name (default=null)
  • useCache (bool): Allow pulling paths from already loaded pages? (default=true)
  • usePagePaths (bool): Allow pulling paths from PagePaths module, if installed? (default=true)

Return value


Path to page or blank on error/not-found.

See Also

$pages methods and properties

API reference based on ProcessWire core version 3.0.130

Twitter updates

  • New post: ProcessWire 3.0.131 adds support for partial/resumable downloads and http stream delivery, and contains several updates to our comments system, among other updates— More
    3 May 2019
  • New post: Quietly and without interruption this week, the ProcessWire.com website (and all subdomains) moved from a single static server to a load-balanced multi-server environment, giving us even more horsepower and redundancy than before— More
    19 April 2019
  • New post: With ProcessWire 3.0.130, this week we’ll take a detailed look at a few useful new API additions made in the last few weeks, along with examples of each—More
    12 April 2019

Latest news

  • ProcessWire Weekly #262
    The 262nd issue of ProcessWire Weekly will cover the latest module updates, both Pro modules and non-commercial ones. We've also got some highlights from the support forum, and a beautiful new site of the week. Read on!
    Weekly.pw / 18 May 2019
  • Lots of module updates
    In this post we take a quick look at the new version of ProFields Repeater Matrix, yet another new version of FormBuilder, and a new version of the GoogleClientAPI module.
    Blog / 17 May 2019
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer