Like find() except returns array of IDs rather than Page objects
- This is a faster method to use when you only need to know the matching page IDs.
- The default behavior is to simply return a regular PHP array of matching page IDs in order.
- The alternate behavior (verbose) returns more information for each match, as outlined below.
Verbose option:
When specifying boolean true for the $options
argument (or using the verbose
option), the return value is an array of associative arrays, with each of those associative arrays
containing id
, parent_id
and templates_id
keys for each page.
Available since version 3.0.46.
Example
// returns array of page IDs (integers) like [ 1234, 1235, 1236 ]
$a = $pages->findIDs("foo=bar");
// verbose option: returns array of associative arrays, each with id, parent_id and templates_id
$a = $pages->findIDs("foo=bar", true);
Usage
// basic usage
$array = $pages->findIDs($selector);
// usage with all arguments
$array = $pages->findIDs($selector, $options = []);
Arguments
Name | Type(s) | Description |
---|---|---|
selector | string, array, Selectors | Selector to find page IDs. |
options (optional) | array, bool, int, string | Options to modify behavior.
|
Return value
array
Array of page IDs, or in verbose mode: array of arrays, each with id, parent_id and templates_id keys.
API reference based on ProcessWire core version 3.0.236