Child categories doesn’t echo if it doesn’t contain at least a post
Question
I’m looping though child categories of a given parent, but what I’ve noticed is that it doesn’t get echoed if the child category itself doesn’t have any posts in relation to it. How can I echo children even though they don’t have any posts?
$children = get_categories(
array( 'parent' => 923)
);
foreach ($children as $child) {
echo "<h6>Child: " . $child->name . "</h6>";
}
0
1 month
2022-07-07T17:54:00-05:00
2022-07-07T17:54:00-05:00 0 Answers
0 views
0
Leave an answer