WordPress.org

Ready to get started?Download WordPress

Ideas

Remove 'Category Base' From Permalinks

  1. nateomedia
    Member

    12345

    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:

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

    Huh?

    To make matters worse, going to http://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: 7 years ago #
  2. James Kirk
    Member

    12345

    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: 7 years ago #
  3. nateomedia
    Member

    12345

    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: 7 years ago #
  4. James Kirk
    Member

    12345

    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: 7 years ago #
  5. m0n5t3r
    Member

    12345

    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: 7 years ago #
  6. Charbax
    Member

    12345

    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: 7 years ago #
  7. ia
    Member

    12345

    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: 7 years ago #
  8. CaioProiete
    Member

    12345

    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
    http://www.pdaexpert.net

    Posted: 7 years ago #
  9. Clintonium
    Member

    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: 7 years ago #
  10. Fortes
    Member

    12345

    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: 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    157 Votes
  • Status

    This is plugin territory