Is it possible to exclude categories by slug in
pre_get_posts? I can exclude categories by ID but it would be better if I can exclude posts by category name or slug.
Here's one way with the following tax query:
'tax_query' => [ [ 'taxonomy' => 'category', 'field' => 'slug', 'terms' => [ 'foo' ], 'operator' => 'NOT IN' ], ],
foo term slug is excluded.