I need to create an Array that contains all of the children slugs of a specific parent category ID.
Let's say I have the following parent category and its children categories:
- ice cream
I need a code/function to use inside
functions.php that returns the slugs of all of the children's slug of a specific parent category like this:
It returns this:
I've tried some variants of this but it didn't work:
$var = wp_list_categories( array( 'child_of' => 1, 'echo' =>false ) ); $array = array(strip_tags($var));
How can I achieve this?