Ideas

Idea: Remove 'Category Base' From Permalinks

  1. The biggest frustration I've had with WordPress is the inability to remove the 'Category Base' from the url permalink structure. I am not alone. This issue has been raised many times on the Support forums.

    Adding this option would really help increase Wordpress's acceptance as a viable CMS alternative. As it stands now, if one mixes categories with pages, one comes up with a really illogical url scheme:

    www.site.com/category/typing/
    www.site.com/about/
    www.site.com/category/forsale/
    www.site.com/intro/

    Huh?

    To make matters worse, going to www.site.com/category/ will result in "Page Not Found". 'Category' is supposed to represent a directory in a website's directory structure!

    It seems to me that there is a simple solution. Allow the user to turn off Pages. Without pages, there should be no need for the Category Base prefix. Those that like Pages can continue to use them, those that don't can ditch them.

    Posted: 2 years ago #
  2. Completely agree with you nateomedia. As we have started the structuring of our site, we are learning the "hard way" about the limitations of the "category" challenges in WP. We've tried to take advantage of the category base to make for better looking URI's, however, the fact remains that they are still in the "category" slot of the permalink.

    Seriously considering just doing away with categoric taxonomy and relying solely on tagging for content structure and navigation.

    Posted: 2 years ago #
  3. I think it's interesting that Matt's own Wordpress Blog relies on a tagging system for categories. Lorelle's Blog wedges in a site map as the category base.

    I think the fact that some of the bigger names in the Wordpress community have had to shy away from using a strictly category based structure shows that something is not quite right here.

    Posted: 2 years ago #
  4. Well, we gotta be careful there, NateO. Both of those scenarios could very easily be them just using the category base settings in the permalink controls. And I could totally understand them being used simply for the potential indexing power that both "tag" and "site-map" could have in the search engine.

    Guess that's the beauty of a php (asp, cmf, whatever) platform/application. You never really know what's behind the curtain (or door number two for that matter. They never picked door number two..:)

    Posted: 2 years ago #
  5. I'll third it... if one wants to have a category base, the category structure template allows it, there is no need for another field. Or, at least, please, please remove the default value!

    Posted: 2 years ago #
  6. So I cannot have my blog list posts from a category in a URL like http://myblogdomain.com/category-name/ ?

    I have to use http://myblogdomain.com/category/category-name/ ?

    Posted: 2 years ago #
  7. charbax, your posts can look like this:

    http://myblogdomain.com/category-name/post-name/

    but when you want to view all posts under category-name, you have to use this:

    http://myblogdomain.com/category/category-name/

    where category is a changeable name.

    the issue here is that it IS inconsistent. i'd rather have posts written as /category-name/post-name/ and therefore moving "one directory higher" we view all posts under category-name, removing the need for "category" in the url. sigh.

    Posted: 2 years ago #
  8. Hello guys!

    It is possible to remove the category base from the permalink. Well, not on the administration panel, but with a small hack:

    On line 371 of the wp-includes/rewrite.php file, you'll see the code:

    $this->category_structure = $this->front . 'category/';

    Now just remove the "category" from the string, and the code should look like:

    $this->category_structure = $this->front . '/';

    Done!

    Regards,
    Caio Proiete
    www.pdaexpert.net

    Posted: 2 years ago #
  9. It looks like it actually is possible to accomplish this through the admin panel with a solution pointed out here by petervcook.

    Just enter /. as the value for Category base.

    Seemed to work perfectly when I tested it. I'd be interested in hearing if anyone discovers other dangers to doing this, other than the obvious potential of collisions between posts, pages, and categories.

    Posted: 2 years ago #
  10. A while back, I coded a plugin to workaround this limitation for my site. I had tried Clintonium's suggestion, but ran into some problems that I honestly can't remember (been a couple of years).

    The plugin is available here: Top Level Categories.

    Hopefully it makes it into the next version!

    Posted: 2 years ago #
  11. fil — I downloaded your plugin and am hoping to give it a test drive soon. I hope it still works with 2.1. thanks!

    Posted: 2 years ago #
  12. The way WordPress handles the URI space is really obscure. Instead of defining a set of global rules that are used each and every time an URI is parsed and the accompanying category, page or post is supposed to be shown, there seems to be at least three completely independent code paths that finds the requested resource. It doesn't make any sense.

    Instead, everything requestable resource in WordPress should have its own URI, minted on the time of creation. A "slug" isn't enough; it doesn't give the author enough control. I'm not saying the author should hard-code the URI of a resource each and every time, but there should be an algorithm for minting the URI of a resource that is the same for all resources. And with resource, I mean "post", "page", "category", "archive" and all other named entities in WordPress.

    That the category listings needs to be prefixed with "category" or some other special value is just dumb. I understand the need for it with WP's current URI architecture, but frankly, the current URI architecture is broken and needs to be fixed.

    Doing some work to define a set of rules to apply on the creation of all resources in WP would fix that problem. In any case, if the rules seems insufficient, they can easilly be expanded and appended upon for a next release of WP. The same PHP function should handle it at least. So, when this is in place, each resource would have a hard-coded URI in the database that allows for easy lookup when it's supposed to be retreived. No need to parse the URI to find out what parts it consists of, etc.

    Posted: 2 years ago #
  13. Just thinking but, really, how bad would it be if Pages and Posts just couldn't have the same names? Then, both could co-exist in peace and harmony.

    Posted: 2 years ago #
  14. http://wordpress.org/support/topic/98005?replies=20#post-559775

    Blizcreak got it working!

    Transcript:
    Solved!

    Here is the solution:

    install this plugin:
    http://fortes.com/projects/wordpress/top-level-cats/

    Use the permalink structure: /%category%/%postname%.html
    set base category as 'category' (or anything else)

    It won't work without the html on the end.

    works like a dream!

    Noel

    Posted: 2 years ago #
  15. The issue is still unresolved. The plugin mentioned above does not entirely fix the problem. For instance, if a site were to use Keyvan Minoukadeh's Paged Comments plugin with Fancy URLs turned on, it would be possible to end up with permalinks that look like this:

    http://www.site.com/category/subcategory/posttitle.hml/comment-page-9/

    Having ".html" in the url is awkward and, for me at least, not the ideal solution to this issue.

    Posted: 2 years ago #
  16. harriscampbell
    Member

    Add my vote to this one. I tried the plugin and it didn't work for me, and I'm also unhappy with the ".html" workaround.

    Posted: 2 years ago #
  17. Agreed, this is massively important for the way I use WP.

    Posted: 2 years ago #
  18. Hi

    see this 5 step tutorial that tells you how to remove category base from permalinks. Please note this is only for wordpress 2.0+
    http://bloggerholic.com/wordpress/how-to-remove-category-base-from-permalinks-45.htm

    Posted: 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

Average Rating

(154)

Your Rating

You can do this with a plugin!