Query post only from categories that have subcategories

You can use a tax query with include_children set to false:

$query = new WP_Query( array(
    'tax_query' => array(
        array(
            'taxonomy' => 'category',
            'field' => 'slug',
            'terms' => 'your-category-slug',
            'include_children' => false,
        ),
    ),
) );

techhipbettruvabetnorabahisbahis forumutaraftarium24eduseduseduedusedueduedueduseduedu