WordPress.org

Ready to get started?Download WordPress

Forums

Remove Category Base in WP 2.7 (2 posts)

  1. nemonet
    Member
    Posted 5 years ago #

    I first installed WP into a sub directory of my website as a "news" blog. Now I am installing on root and will use as a CMS. My news blog has many index pages with google etc, so my plan was to make a category called "news" and all my category's would then be childs of "news". So my urls would look like mydomain.com/news/category/post/.

    This seemed to work fine when navigating to a post, however, when clicking on category links it takes me to /mydomain.com/category/news/subcat/post/.

    I tried removing code in classes.php etc which only resulted in 404's. All the hacks and tricks I have found do not work with my setup, they either require a .html extention on the url, or do not work with childs category's.

    I could really use help, do not want to loose indexed pages or have a non-logical architecture.

    My permalink structure is %category%/%slug% and I am running wp 2.7.

    If you are a pro, I can kick you down some cash via paypal donate.

    Thanks....

  2. nemonet
    Member
    Posted 5 years ago #

    Here is the code that worked for me with only 1 level of categorys (no childs)

    if (@$this->query_vars["name"] == "page")
    {
    $tmp_ar = $this->query_vars;
    $this->query_vars = array();
    $this->query_vars["paged"] = str_replace("/", "", $tmp_ar["page"]);
    $this->query_vars["category_name"] = $tmp_ar["category_name"];
    }

Topic Closed

This topic has been closed to new replies.

About this Topic