Trying To Get Child Categories To Show, Issue With foreach Loop

Do the categories all have posts, change line 2 to:

$categories = wp_list_categories('hide_empty=0&title_li=0&child_of=".$categoryslug->term_id");

This sets it to display all categories even if empty

If that doesn’t work then you need to echo each part and find the cause of the “error” so echo each element e.g.

echo $categoryslug;

if that works then change to

echo $categoryslug->term_id;

If that works then print the array of categories e.g.

print_r($categories);

Echoing each element individually will lead you to the culprit and then you can find the root cause