Short Answer
If your category URLs look like /?category=761
, you are still on Plain permalinks.
Switch to any “pretty” structure (e.g. /%category%/%postname%/
) and save—WordPress will output /category/slug/
with the trailing slash.
Already on pretty permalinks and the slash is still missing? Add this in a site-specific plugin or Code Snippets:
add_filter( 'category_link', 'force_cat_slash', 10, 2 );
add_filter( 'term_link', 'force_cat_slash', 10, 2 ); // tags & custom taxonomies
function force_cat_slash( $link ) {
return trailingslashit( $link );
}
Flush permalinks once (Settings → Permalinks → Save).
All category (and other taxonomy) links will now end with /
.
• Diagnose
- Settings → Permalinks
If it says “Plain”, change it. - Click Save even if nothing changed (flushes rewrite rules).
- Visit
https://example.org/category/your-slug/
to confirm the slash.
• Fix (if still no slash)
- Add the filter above — light-weight, future-proof.
- Refresh permalinks after adding the code.
• Alternate catch-all redirect (server level)
Apache – place above the WP block in .htaccess
:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [L,R=301]
Nginx – inside server {}
:
location ~ [^/]$ {
return 301 $uri/;
}
• Why bother?
- SEO –
/category/slug
and/category/slug/
are distinct; choose one, redirect the other. - Caching/CDN keys – path must be unique and canonical.
- Consistency – matches WordPress’s default permalink behaviour for posts and pages.