WordPress.org

Ready to get started?Download WordPress

Forums

Category Priority in URL When Using Multiple Categories (11 posts)

  1. TrainTheK9
    Member
    Posted 4 years ago #

    I need to be able to manipulate which category is being used in a URL when multiple categories are checked. Is there a way to do that? If so, how?

    My blog as a category called "featured articles". My intent is that this will never be a permanent category for any article, therefore, I don't ever want the URL for any of my posts to be:

    http://www.mydomain.com/featured-articles

    However, no matter what I do, every time I check the featured articles category for a post and update it, no matter what other category is selected, the featured articles always takes over as the category slug within the URL.

    I need to know what is causing this, and how to fix it or override it so that I can be the one to control what the permanent URL will be "permalink"?

    Does anyone know how to make this happen, or what I need to do? Is there a plugin for this or something?

  2. curtismchale
    Member
    Posted 4 years ago #

    It's a permalink setting. Change them it should fix itself.

    http://codex.wordpress.org/Using_Permalinks

  3. TrainTheK9
    Member
    Posted 4 years ago #

    Yes, I found the article in the link provided while trying to find the solution myself online. I understand how permalinks work. Mine is set to a custom structure:

    /%category%/%postname%

    This is exactly the way I want it. However, I don't see anything in the permalink section that allows me to prioritize WHICH category is put there when multiple categories are selected.

    What I'm trying to avoid is having problems when people bookmark a page and want to come back to it while it is a featured article, and then finding they can't reach it at some point in the future when it is no longer featured.

    I hope someone can help. I really need this resolved, and I have searched everywhere!

  4. TrainTheK9
    Member
    Posted 4 years ago #

    Can anyone help with this???

  5. TrainTheK9
    Member
    Posted 4 years ago #

    Please? Or at least tell me where to go to get help?

  6. curtismchale
    Member
    Posted 4 years ago #

    That is how WordPress is supposed to function. If you don't want the category to change then take the category out of your permalink structure.

  7. TrainTheK9
    Member
    Posted 4 years ago #

    I don't get it. Either I don't understand what you mean, or I am not communicating my need effectively.

    I need the featured articles category to remain, so how would I remove it from the permalink structure if I am using %category%/%post% as the structure, and WordPress is deciding all by itself to use the featured articles category slug whenever it's checked?

    Maybe I should ask this: What criteria does the WordPress software use to determine which category is used when multiple categories are selected for a post? For example, is there a number value associated with each category in the coding somewhere, and WordPress decides the priority based on that coding? (For example, category 3 would have priority over category 15.) If so, how can I change the number value assigned to a category in order to force a category to the lowest priority, or to force others to a higher priority?

    Thanks for your patience Curtis, and thanks to anyone else who can help me get to the bottom of this! I hope to hear back from you soon!

  8. Nalin
    Member
    Posted 4 years ago #

    Dude, just found one solution.

    Category priority always based on ID.

    If your category id's are 1 99 it always take ID 1 as priority.

    so the category you want exclude from url (When its has multiple) should take very big id number. like 9999999 or some thing.

    Here is the way to do this.
    1. login to you cpanel or control panel and access the data base thru phpmyadmin

    2. find these two tables
    - wp_term_taxonomy
    - wp_terms

    3. now you should find the present category id. (this can be done easily by hovering category in wordpress back end. url has this id)

    4. change these fields into new id
    - wp_terms Tables term_id field
    - wp_term_taxonomy Tables term_taxonomy_id field and term_id field

    hope this would helpful.

    Let me know.

  9. jerdei
    Member
    Posted 4 years ago #

    nalin_duminda:

    Thanks for the advice. Worked like a charm for parent and sub categories.

    One thing for people who are going to do this. Make a backup of the Data Base first. Just in case.

    Also note that if you are changing a Parent Category ID and have Child Categories in that Parent then you will want to edit the Child Categories to match the NEW PARENT ID.

    Keep in mind that for EVERY POST currently using that category ID nothing happens to the post it's self but it will no longer belong to the Category because the ID has changed. You can just edit each post and re-assign the category again.

  10. pjeloka
    Member
    Posted 3 years ago #

    Please help!

    I followed Nalin's instructions and updated the 2 tables with new IDs based on the priority I wanted to give each category. The IDs became 510, 520, 530, etc.

    Based in Jerdei's comment, I republished all the posts again using my desktop tool - Windows live writer.

    But now, the navigation that showed the categories and the Archives page that showed it aren't showing anything.

    Blog: http://www.delhiledger.com

    On the home page: The category navigation was on the right of the logo below the top level navigation of About, etc.
    On the Archive page: its the first part of the page that's blank now.

    Please help!

  11. pjeloka
    Member
    Posted 3 years ago #

    Alright, fixed. It was a different plugin 'My category Order' that was interfering somehow. I had deactivated it when I was making all the changes. Activating it fixed it. Not sure why but after several hours of working at this, I'm just glad.

Topic Closed

This topic has been closed to new replies.

About this Topic