Custom taxonomy returns 404 even with saving permalinks

I’ve found my solution.. In my functions.php I found the following functions which returns a 404 on several types:

  function remove_wp_archives(){
    //If we are on category or tag or date or author archive
    if( is_category() || is_tag() || is_date() || is_author() || is_tax() ) {
      global $wp_query;
      $wp_query->set_404(); //set to 404 not found page
      status_header(404);
      nocache_headers();
    }
  }
  add_action('template_redirect', 'remove_wp_archives');