Zend certified PHP/Magento developer

Magento 2 filter category by id in category tree

I’m overriding this default block file and need to filter the category by id.

MagentoThemeBlockHtmlTopmenu

how to addFieldToFilter to this children

protected function _getHtml(
            Node $menuTree,
            $childrenWrapClass,
            $limit,
            array $colBrakes = []
        ) {
            $html = '';
    
            $children = $menuTree->getChildren();
            $childLevel = $this->getChildLevel($menuTree->getLevel());
            $this->removeChildrenWithoutActiveParent($children, $childLevel);
    
            $counter = 1;
            $childrenCount = $children->count();
    
            $parentPositionClass = $menuTree->getPositionClass();
            $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-';
    
            /** @var Node $child */
            foreach ($children as $child) {
                $child->setLevel($childLevel);
                $child->setIsFirst($counter === 1);
                $child->setIsLast($counter === $childrenCount);
                $child->setPositionClass($itemPositionClassPrefix . $counter);
    
                $outermostClassCode = '';
                $outermostClass = $menuTree->getOutermostClass();
    
                if ($childLevel === 0 && $outermostClass) {
                    $outermostClassCode = ' class="' . $outermostClass . '" ';
                    $this->setCurrentClass($child, $outermostClass);
                }
    
                if ($this->shouldAddNewColumn($colBrakes, $counter)) {
                    $html .= '</ul></li><li class="column"><ul>';
                }
    
                $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
                $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml(
                    $child->getName()
                ) . '</span></a>' . $this->_addSubMenu(
                    $child,
                    $childLevel,
                    $childrenWrapClass,
                    $limit
                ) . '</li>';
                $counter++;
            }
    
            if (is_array($colBrakes) && !empty($colBrakes) && $limit) {
                $html = '<li class="column"><ul>' . $html . '</ul></li>';
            }
    
            return $html;
        }

I need some particulate parent categories alone to show in topmenu