use Joomla\CMS\Category\CategoryNode; // Load category tree $categories = CategoryNode::load(); // Get the root node $rootNode = $categories->getRootNode();
use Joomla\CMS\Category\CategoryNode; use Joomla\CMS\Category\CategoryPath; // Load category tree $categories = CategoryNode::load(); // Construct a category path $path = new CategoryPath('category/specific-category'); // Retrieve the node for the specified category $node = $categories->getNodeByPath($path); // Get the root node $rootNode = $node->getRootNode();The getRootNode method is part of the Joomla\CMS\Category package library, which provides a range of functions for working with category trees in Joomla applications.