Given an ID return a path to a page, without loading the actual page
Please note
- Always returns path in default language, unless a language argument/option is specified.
- Path may be different from 'url' as it doesn't include $config->urls->root at the beginning.
- 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.
- 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.
Usage
// basic usage
$string = $pagesLoader->getPath($id);
// usage with all arguments
$string = $pagesLoader->getPath($id, $options = []);
Arguments
Name | Type(s) | Description |
---|---|---|
id | int, 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:
|
Return value
string
Path to page or blank on error/not-found
PagesLoader methods and properties
API reference based on ProcessWire core version 3.0.236