add_filter('getarchives_where', 'custom_archives_where', 10, 2); add_filter('getarchives_join', 'custom_archives_join', 10, 2); function custom_archives_join($x, $r) { global $wpdb; $cat_ID = $r['cat']; if (isset($cat_ID)) { return $x . " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.ter