Description
This plugin completely removes the mandatory ‘Category Base’ and all the parents from your
category permalinks (e.g. /category/parent-category/my-category/ becomes /my-category/).
It also shortens post permalinks when you use the /%category%/ permastruct, so a post filed
under a deeply nested category still gets a short URL.
If a post or page already uses the same slug as a category, the post keeps the clean URL and
the category is served from /my-category-cat/ instead.
Installation
- Install and activate the plugin through the ‘Plugins’ menu in WordPress.
- That’s it. Your categories are now reachable at http://mysite.com/my-category/
Deactivating the plugin restores the stock WordPress permalinks.
FAQ
-
My category URLs did not change
-
Go to Settings > Permalinks and press Save once. That rebuilds the rewrite rules.
-
Do old links with the parent path still work?
-
Yes.
/parent-category/my-category/keeps resolving to the same archive.
Avis
Contributeurs & développeurs
« No Category Parents » est un logiciel libre. Les personnes suivantes ont contribué à cette extension.
ContributeursTraduisez « No Category Parents » dans votre langue.
Le développement vous intéresse ?
Parcourir le code, consulter le SVN dépôt, ou s’inscrire au journal de développement par RSS.
Historique des changements
0.3.1
- Update the plugin URI to point at the plugin landing page.
0.3.0
- Compatible with WordPress 7.0 and PHP 8.
- Fixed: parent categories were only removed one level deep. A category nested two or more
levels down (parent > child > grandchild) kept its immediate parent in the URL. Links are
now rebuilt from the term instead of being regex-patched, so any depth works. - Fixed: PHP 8 warnings (« Undefined array key 0 », « Attempt to read property ID on null »)
when building permalinks. - Fixed: the rewrite rules were flushed on every page load, rebuilding and re-saving the
whole rule set on each request. Flushing now happens once, only after a category changes.
Measured on a local WordPress 7.0 install: ~197 ms/request before, ~114 ms/request after. - Added: category feeds (
/my-category/feed/) now resolve. - Changed: all functions are prefixed with
ncp_. Earlier versions declared generic names
such asfilter_category()andmy_flush_rules()in the global namespace, which could
collide with a theme or another plugin. - Changed: the category base is now forced empty through a filter instead of being written
to the database on every request. - Added:
ncp_collision_suffixandncp_post_link_categoryfilters. - Removed: leftover debug code and an unused
idquery var.
0.2.4.1
- Quickfix: fixed pagination bug
0.2.4
- Tested up to WP 4.1
- Fixed pagination problem (special thanks to Lukáš Wojnar).
0.2.3
- Changed some links.
- Fixed « empty category » problem (special thanks to absolutex).
0.2.2
- In 0.2.1 when the « Category Base » field wasn’t empty the plugin didn’t work. Now the
« Category Base » field will automatically be empty when you activate the plugin.
0.2.1
- Minor changes in the comments.
0.2
- The plugin now works with the permastruct /%category%/ and also replaces the post permalinks.
- Other minor fixes.
