WordPress.org

Support

Support » How-To and Troubleshooting » category URL without “category” in it

category URL without “category” in it

Viewing 3 replies - 1 through 3 (of 3 total)
  • Basically you can’t without major changes to the core code. Reason is, how is WordPress to know that

    http://example.com/news/

    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.

    >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.

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘category URL without “category” in it’ is closed to new replies.
Skip to toolbar