WordPress Loop: List All Posts by a Category & Subcategory

The cat and category_name parameters for WP_Query display “posts that have this category (and any children of that category)”.

There are also examples of doing this in the Codex.

$query = new WP_Query( 'cat=4' );
// or
$query = new WP_Query( 'category_name=staff' );

I am not 100% sure what you mean by “I need all to be autopopulated”, but if you want WordPress to “just know” what category you want there is no such ESP-based function in either WordPress or PHP. You have to tell the query what category to use, but you don’t have to hard-code to ID or the name. It may be possible to logically derive the appropriate category but you have not provided any details at all about what the criteria would be for making that decision. You don’t even say what page you are on, or whether you talking about the front or the back end. Without that detail a better answer is going to be difficult.