Often times there is a need to change all Magento Categories from their default setting of ‘Is Anchor = No’ to ‘Is Anchor=Yes’. Making the change to an Anchor Category activates the Layered Navigation, also known as filtered navigation. If you have multiple Categories this can be a time-consuming task to do manually.
The better way is to use the following code to run through and change all Categories to Anchor in just 1 Click.