---
title: Anchor Categories
slug: klevu-magento-v4/entities-anchor-categories
docTags: 
createdAt: 2024-08-15T15:32:23.123Z
---

Out of the box, the Klevu plugin respects the `is_anchor` category setting.

To change this behaviour and ignore anchor categories you can add a before plugin on `ParentAnchorCategoryIdProvider` and return an empty array.

```xml
<type name="Klevu\IndexingProducts\Service\Provider\Catalog\ParentAnchorCategoryIdProvider">
  <plugin name="Vendor_Module::ParentAnchorCategoryIdProvider"
          type="Vendor\Module\Plugin\Service\Provider\Catalog\ParentAnchorCategoryIdProviderPlugin"/>
</type>
```

Create the Plugin class.

:::CodeblockTabs
Vendor/Module/Plugin/Service/Provider/Catalog/ParentAnchorCategoryIdProviderPlugin.php

```php
<?php

namespace Vendor\Module\Plugin\Service\Provider\Catalog;

use Klevu\IndexingApi\Service\Provider\Catalog\ParentAnchorCategoryIdProviderInterface;

class ParentAnchorCategoryIdProviderPlugin
{
    /**
     * @param ParentAnchorCategoryIdProviderInterface $subject
     * @param int[] $categoryIds
     *
     * @return int[]
     */
    public function beforeGet(
        ParentAnchorCategoryIdProviderInterface $subject,
        array $categoryIds,
    ): array {
        return [[]];
    }
}
```
:::

Setting `categoryIds` param as an empty array will return an empty array skipping any extra database calls.
