title: Custom post type archive in sidebar widget of post
body: <p>This works fine. I see custom post type archive in dropdown but when I select any month, I see all custom posts on that archive page. While there is only one post in every month, for e.g. I have 1 post in month of July and 1 in August, the dropdown counter shows correct but when I select them I see all custom posts instead of just one. Is there any solution for this?</p>
  
  <pre><code>   add_filter( 'getarchives_where', 'custom_getarchives_where' );
      function custom_getarchives_where( $where ){
          $where = str_replace( "post_type = 'post'", "post_type IN ( 'post', 'fruits' )", $where );
          return $where;
      }
  
      add_action( 'pre_get_posts', 'add_podcasts_to_archive' );
      function add_podcasts_to_archive( $query ) {
          if ( $query-&gt;is_main_query() &amp;&amp; $query-&gt;is_archive() &amp;&amp; !is_admin() )
              $query-&gt;set( 'post_type', array( 'post', 'fruits' ) );
          return $query;
      }
  </code></pre>