PagesRaw::find() method

Find pages and return raw data from them in a PHP array

Available since version 3.0.172.

Usage

// basic usage
$array = $pagesRaw->find($selector);

// usage with all arguments
$array = $pagesRaw->find($selector, $field = '', array $options = []);

Arguments

NameType(s)Description
selectorstring, array, Selectors
field (optional)string, array, Field

Name of field/property to get, or array of them, CSV string, or omit to get all (default='')

  • Optionally use associative array to rename fields in returned value, i.e. ['title' => 'label'] returns 'title' as 'label' in return value.
  • Specify parent.field_name or parent.parent.field_name, etc. to return values from parent(s). 3.0.193+
  • Specify references or references.field_name, etc. to also return values from pages referencing found pages. 3.0.193+
  • Specify meta or meta.name to also return values from page meta data. 3.0.193+
options (optional)array

See options for Pages::find

  • objects (bool): Use objects rather than associative arrays? (default=false)
  • entities (bool|array): Entity encode string values? True, or specify array of field names. (default=false)
  • nulls (bool): Populate nulls for field values that are not present, rather than omitting them? (default=false) 3.0.198+
  • indexed (bool): Index by page ID? (default=true)
  • flat (bool|string): Flatten return value as ["field.subfield" => "value"] rather than ["field" => ["subfield" => "value"]]? Optionally specify field delimiter, otherwise a period . will be used as the delimiter. (default=false) 3.0.193+
  • Note the objects and flat options are not meant to be used together.

Return value

array


PagesRaw methods and properties

API reference based on ProcessWire core version 3.0.244

Latest news

  • ProcessWire Weekly #559
    The 559th issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
    Weekly.pw / 25 January 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

“We were really happy to build our new portfolio website on ProcessWire! We wanted something that gave us plenty of control on the back-end, without any bloat on the front end - just a nice, easy to access API for all our content that left us free to design and build however we liked.” —Castus, web design agency in Sheffield, UK