Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

For each category I have 2 sub categories with same name. For example, Category1 has two subcategories: Sub1, Sub2.

On the category archive page, I want to display the posts from Sub1 and Sub2. So how can I use the post loop to always get posts from Sub1 and Sub2.

I have thought of something like this:

$args = array(
    'category_name' => 'sub1',
    'posts_per_page' => 10

But the problem is that each subcategory "Sub1" will have different slug. Is it possible to get the posts by the subcategory name and specifying its parent name?

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.