Create Category Programmatically
Here I’ve attached the PHP code for creating a category programmatically. You can write this in any controller or a PHP file that calls Magento’s bootstrapper. In the below example we are creating a category under a default parent category.
If you have any query or suggestions, feel free to ask me via the comment section below.