WordPress adds /category/ to every category archive URL by default. So your “News” category lives at /category/news/ rather than just /news/. Most sites don’t need that prefix – it’s ugly, and it gets in the way of clean URL structures.
The obvious fix is to grab an existing plugin like Remove Category URL. It has a ton of active installs and looks straightforward. But when I reviewed the source, it was full of upsells, nags, and telemetry. Yuck. A simple utility plugin that strips a string from a URL has no business phoning home or pestering you to upgrade. So I built my own…
What it does
This little plugin removes /category/ from category archive URLs, and issues 301 redirects from the old URLs to the new ones. So /category/news/ becomes /news/, and anyone hitting the old URL is automatically redirected. Clean.
It handles:
- Root categories:
/category/news/→/news/ - Nested categories:
/category/news/local/→/news/local/ - Paginated archives:
/news/page/2/ - Feed URLs:
/news/feed/ - Legacy redirects: any request to the old
/category/base gets a 301 to the clean URL
How it works
WordPress builds category URLs using a permastruct string. By default it’s category/%category%. The plugin hooks into init and rewrites that to just %category%, so get_category_link() returns the category slug by itself.
The rewrite rules are rebuilt from scratch via the category_rewrite_rules filter. For each category, the plugin generates rules for the archive, paginated pages, and feeds — joining parent slugs with / for nested categories. It also adds a catch-all rule that maps the old /category/<slug>/ pattern to a custom category_redirect query var.
The redirect itself is handled in the request filter. If category_redirect is set, the plugin issues a 301 to the clean URL and exits. Simple and reliable.
Rewrite rules are flushed on activation, deactivation, and whenever a category is created, edited, or deleted. New categories should get clean URLs automatically, without needing a manual flush.
