$pages->findJoin() method

Find pages and specify which fields to join (overriding configured autojoin settings)

This is a useful optimization when you know exactly which fields you will be using from the returned pages and you want to have their values joined into the page loading query to reduce overhead. Note that this overrides the configured autojoin settings in ProcessWire fields.

If a particular page in the returned set of pages was already loaded before this method call, then the one already in memory will be used rather than this method loading another copy of it.

Available since version 3.0.172.


// 1. Example of loading blog posts where we want to join title, date, summary:
$posts = $pages->findJoin("template=blog-post", [ 'title', 'date', 'summary' ]);

// 2. You can also specify the join fields as a CSV string:
$posts = $pages->findJoin("template=blog-post", 'title, date, summary');

// 3. You can also use the join functionality on a regular $pages->find() by specifying
// property 'join' or 'field' in the selector. The words 'join' and 'field' are aliases
// of each other here, just in case you have an existing field with one of those names.
// Otherwise, use whichever makes more sense to you. The following examples demonstrate
// this and all do exactly the same thing as examples 1 and 2 above:
$posts = $pages->find("template=blog-post, join=title|date|summary");
$posts = $pages->find("template=blog-post, field=title|date|summary");
$posts = $pages->find("template=blog-post, join=title, join=date, join=summary");
$posts = $pages->find("template=blog-post, field=title, field=date, field=summary");

// 4. Let’s say you want to load pages with NO autojoin fields, here is how.
// The following loads all blog-post pages and prevents ANY fields from being joined,
// even if they are configured to be autojoin in ProcessWire:
$posts = $pages->findJoin("template=blog-post", false);
$posts = $pages->find("template=blog-post, join=none"); // same as above


// basic usage
$items = $pages->findJoin($selector, $joinFields);

// usage with all arguments
$items = $pages->findJoin($selector, $joinFields, array $options = []);


selectorstring, array, Selectors
joinFieldsarray, string, bool

Array or CSV string of field names to autojoin, or false to join none.

options (optional)array

Return value

$pages methods and properties

API reference based on ProcessWire core version 3.0.185

Twitter updates

  • ProcessWire 3.0.185 (dev) core updates, plus new Session Allow module— More
    17 September 2021
  • Three new ProcessWire Textformatter modules: Find/Replace, Markdown in Markup, and Emoji— More
    3 September 2021
  • This week we have a new master version released after a year in the making. With nearly 40 pull requests, hundreds of new additions and more than 100 issue reports resolved, this new version has a ton of great new stuff— More
    27 August 2021

Latest news

  • ProcessWire Weekly #388
    In the 388th issue of ProcessWire Weekly we'll check out the latest core update, introduce two new third party modules, and more. Read on!
    Weekly.pw / 16 October 2021
  • ProcessWire 3.0.184 new master/main version
    This week we have a new master/main version released after a full year in the making. As you might imagine, this new version has a ton of great new stuff and we’ll try to cover much of it here.
    Blog / 27 August 2021
  • 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