category URL without "category" in it (4 posts)

  1. maphew
    Posted 9 years ago #

    Hi, how do I get wordpress to create urls without the word "category" in them?

    Instead of:

    I want:

    I've read http://codex.wordpress.org/Using_Permalinks and don't see anything there for this scenario (I've I'm wrong, please advise!)

    I'm using wordpress 2.0.4


  2. Kafkaesqui

    Posted 9 years ago #

    Basically you can't without major changes to the core code. Reason is, how is WordPress to know that


    is a category, and not a Page? In the background some pattern matching is going on to figure what a particular *virtual* url is for. Having a static component in the url (i.e. 'category') provides a flag of sorts so that WordPress provides the proper query.

  3. maphew
    Posted 9 years ago #

    >Reason is, how is WordPress to know that http://example.com/news/ is a category, and not a Page?

    umm, because page "News" doesn't exist?

    I get your point though. Thanks for telling me I wasn't just missing something simple. Guess I'll just have to live with a category prefix of "c" or something.

  4. Mark
    Posted 9 years ago #

    This comes up surprisingly often. So often, in fact, that it may be worth considering whether it wouldn't be better to make example.com/categoryname the standard case, and to restrict the creation of page (or post) titles synonymous to category names, or at least provide an option to do so.

    Anyway, a rather ugly (but functional on small-scale sites) workaround I use sometimes is to actually create a page at that location and to create a custom template for that page which basically says 'include posts from cat X'. Obviously, it doesn't change the output of any wp_list_cats-like functions (i.e. those will still include the category prefix unless you hack classes.php as detailed here); but for a limited number of categories (and for those who don't like to hack core files), it works quite well.

Topic Closed

This topic has been closed to new replies.

About this Topic