WP Manifestindependent plugin directory
manifest / seo / remove-category-from-slug

Remove Category from Slug

Strip "category" from post archive URL slugs in WordPress

by Paul Faulkner · github.com/headwalluk/remove-category-from-slug

0stars
8release downloads
0forks

Install

The author publishes release zips, so WP-CLI can install straight from GitHub:

wp plugin install https://github.com/headwalluk/remove-category-from-slug/releases/download/v1.0.1/remove-category-from-slug.zip

Readme

Remove Category from Slug

A small, dependency-free WordPress plugin that strips the /category/ base from category archive URLs.

/category/news/            →  /news/
/category/parent/child/    →  /parent/child/
/category/news/page/2/     →  /news/page/2/
/category/news/feed/       →  /news/feed/

Old /category/... URLs are 301-redirected to the new form, so links and SEO carry over.

No settings page, no telemetry, no third-party SDKs. The whole plugin is a single file.

How it works

Three WordPress rewrite hooks do all the work:

  1. init — overrides the category permastruct to %category% so get_category_link() returns the bare slug.
  2. category_rewrite_rules — rebuilds the rule set, emitting root, paged, and feed rules per category. Parent slugs are joined with /. A catch-all rule maps any leftover /<old_base>/... request into a category_redirect query var.
  3. request — sees category_redirect and issues a 301 to the new URL.

Rewrite rules are flushed automatically on activation, deactivation, and whenever a category is created, edited, or deleted.

If Yoast SEO is active, the wpseo_canonical filter re-points category-archive canonical URLs at the bare slug too, since Yoast computes its own canonical rather than using core's. The filter is a no-op when Yoast is not installed.

Installation

  1. Copy the plugin folder to wp-content/plugins/.
  2. Activate it from the Plugins screen.

Development

PHP_CodeSniffer with WordPress Coding Standards:

phpcs              # Check
phpcbf             # Auto-fix
phpcs              # Re-check

See CLAUDE.md for architecture notes and project conventions.

License

GPL-2.0-or-later. See LICENSE.

Read the full README on GitHub →

Releases

TagPublishedAssetDownloads
v1.0.1 Jun 28, 2026 remove-category-from-slug-1.0.1.zip 0
v1.0.1 Jun 28, 2026 remove-category-from-slug.zip 5
v1.0.0 Apr 27, 2026 remove-category-from-slug.zip 1
v1.0.0 Apr 27, 2026 remove-category-from-slug-1.0.0.zip 2