getDB(); foreach ($pagesKey as $pageKey) { try { $page = new Page($pageKey); // Check if the page is available to be parent if ($page->isParent()) { // Check page status if ($page->published() || $page->sticky() || $page->isStatic()) { // Check if the query contains in the title $lowerTitle = Text::lowercase($page->title()); if (Text::stringContains($lowerTitle, $query)) { $tmp[$page->title()] = $page->key(); } } } } catch (Exception $e) { // continue } } exit (json_encode($tmp)); ?>