Custom post type posts don’t show in archive widget

For the sake of explanation, here is how to solve the problem.

By default, wordpress doesn’t include custom post types in the main query, that is why you only get posts from the post type post in the archive pages. Also, widgets by default also does not include custom post types.

As @birgire described in the post I flagged as duplicate

The Archive widget is using wp_get_archives() to display the archive.

If you want to target all the wp_get_archives() functions, you can use the getarchives_where filter to add your custom post type:

add_filter( 'getarchives_where', function ( $where )
{
    $where = str_replace( "post_type="post"", "post_type IN ( 'post', 'podcasts' )", $where );
    return $where;
});

That should take care of displaying custom post type posts in the archive widget, but these will still not appear and give you a 404 error if you go to the specific archive, simply because you still have to include your custom post type in your archive page (archive.php)

To accomplish this, you can use the pre_get_posts action to add these custom post types to the main query before it is run. To specifically target archive pages, you can use the is_archive() conditional tag in conjuction with your function

add_action( 'pre_get_posts', function ( $query ) 
{
  if (    !is_admin() 
       && $query->is_main_query() 
       && $query->is_archive()
   )
     $query->set( 'post_type', array( 'post', 'podcasts' ) );
});