I've played around for hours but still can't wrap my head around the right arguments for a secondary WP_Query which shall fetch all posts of my_custom_post_type that are in the queried category.
Scenario is a custom category.php template file (writing a custom theme) to render a category archive for custom post type posts. Hence, the main query is by category name / slug retrieved from the URL (e.g. /category/cat-name). By default, the main query doesn't fetch custom post type posts, though. Please note, I use the default category taxonomy with my custom post type.
So, I am looking for something like
$args = array( 'post_type' => 'my_custom_post_type', 'category_id' => $current_category_id );
However, how to get $current_category_id from the main query? Or, how to do it the right way?