Like find() but returns only the first match as a Page object (not PageArray).
This is functionally similar to the get()
method except that its default behavior is to
filter for access control and hidden/unpublished/etc. states, in the same way that the
find()
method does. You can add an include=...
to your selector string to bypass. This method also accepts an $options
array, whereas get()
does not.
Available since version 3.0.0.
Example
// Find the newest page using the blog-post template
$blogPost = $pages->findOne("template=blog-post, sort=-created");
Usage
// basic usage
$page = $pages->findOne($selector);
// usage with all arguments
$page = $pages->findOne($selector, $options = []);
Arguments
See Also
API reference based on ProcessWire core version 3.0.236