WordPress.org

Ready to get started?Download WordPress

Forums

The word "category" displays in permalinks (8 posts)

  1. eastbayinsomniac
    Member
    Posted 6 years ago #

    I use a custom permalink structure:
    /%category%/%postname%/

    In individual posts, this works fine:
    http://www.eastbayinsomniac.com/thirsty/mcnallys-pub/

    But in category/archives links, the word "category" displays in the URL, which is redundant:
    http://www.eastbayinsomniac.com/category/thirsty/beer/

    "thirsty" is the category.

    Any suggestions?

    Thanks.

  2. Adam Brown
    Member
    Posted 6 years ago #

    That's what is supposed to happen. If you don't want it to happen, may I suggest the search? People ask this all the time.

    http://wordpress.org/search/category+permalink?forums=1

    edit: I realize now I misread your post slightly, but I still suggest the search first...

  3. eastbayinsomniac
    Member
    Posted 6 years ago #

    OK, I did that and I modified my wp-includes/rewrite file as suggested in this thread:

    http://wordpress.org/support/topic/108875?replies=4

    I removed the word "categories" from this line:

    if (empty($this->category_base))
    			$this->category_structure = $this->front . '/';

    I tried it with and without the backslash. Bothways now I have no category page. Try clicking on my link above. There will be nothing there. Can you view the section of code below and/or suggest an alternative?

    `function get_category_permastruct() {
    if (isset($this->category_structure)) {
    return $this->category_structure;
    }

    if (empty($this->permalink_structure)) {
    $this->category_structure = '';
    return false;
    }

    if (empty($this->category_base))
    $this->category_structure = $this->front . '/';
    else
    $this->category_structure = $this->category_base . '/';

    $this->category_structure .= '%category%';

    return $this->category_structure;`

  4. eastbayinsomniac
    Member
    Posted 6 years ago #

    p.s. I put the word "category" back into the rewrite file so my content would be there if anyone was viewing. But the hack did not work for me. Unless I need to remove it in multiple instances. Please advise... Thanks

  5. moshu
    Member
    Posted 6 years ago #

    No, you shouldn't mess around with it. There is a reason why it needs to be there.
    You can replace it in your admin interface with any other word.

  6. eastbayinsomniac
    Member
    Posted 6 years ago #

    Moshu--is there a fix that would eliminate the redundancy of /category/(category)? It seems odd to have "category" in the URL. I haven't seen this behavior on other blogs, and I don't recall it being the case prior to upgrading to 2.3. Any advice besides semantics substitution? Thanks-

  7. moshu
    Member
    Posted 6 years ago #

    It has been always there - when viewing category archives.

  8. SpiderDog
    Member
    Posted 6 years ago #

    I would also be interested in learning how to eliminate the word '/category/' from the permalink URL. Has anyone come up with a solution? Maybe it's an idea for a plugin we need.

Topic Closed

This topic has been closed to new replies.

About this Topic