WordPress.org

Ready to get started?Download WordPress

Forums

Category ID's and permalinks. (9 posts)

  1. Martyn_
    Member
    Posted 7 months ago #

    I see in other places that permalinks generated from a category, or nested categories behave according to the id of the categories in question. The recommendation seems to be to go in and edit the wp_terms table directly until you get the behaviour you want.

    That seems pretty bad IMO, but nevertheless the question is will altering the id's of categories there affect existing content or will everything stay labelled as it was originally?

    Is there any plugin out there that manages this for you?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 7 months ago #

    permalinks generated from a category, or nested categories behave according to the id of the categories in question

    Sorry? Can you elaborate on that?

    The recommendation seems to be to go in and edit the wp_terms table directly

    What recommendation where?

  3. Martyn_
    Member
    Posted 7 months ago #

    References:

    http://wordpress.org/support/topic/subcategories-not-showing-up-in-uri-with-pretty-permalinks?replies=5

    Whist the woedpress codex http://codex.wordpress.org/Using_Permalinks states:

    "When you assign multiple categories to a post, only one can show up in the permalink. This will be the lowest numbered category (see Manage Categories). The post will still be accessible through all the categories as normal."

    But fails to provide a means of acheiving the required numbering - the dashboard interface for managing categories makes no mention of the associated number.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 7 months ago #

  5. Martyn_
    Member
    Posted 7 months ago #

    @esmi Thanks. However the question isn't really how to find them - I know that the order they are in breaks what I want to do. the question is how to fix it in a sane way - the consequences of switching them with a db editor are unclear (and using a db editor directly quite frankly gives me the heeby jeebies anyway).

    Is it better to create a new category structure and try something like http://wordpress.org/plugins/bulk-move/ ? Would that be a safer approach?

    Should WP not provide a bulk move function if the category ID is so hardwired to how the site behaves?

  6. esmi
    Theme Diva & Forum Moderator
    Posted 7 months ago #

    the consequences of switching them with a db editor

    Just don't go there! You're far more likely to totally wreck your site. The WordPress database uses relational tables, so any given category id is used across multiple tables.

    Would that be a safer approach?

    Infinitely safer.

    Should WP not provide a bulk move function if the category ID is so hardwired to how the site behaves?

    Sorry?. I don't follow your phrase "the category ID is so hardwired to how the site behaves? Can you elaborate? Maybe it would help if you described the problem you currently have?

  7. Martyn_
    Member
    Posted 7 months ago #

    OK the problem:

    I have a populated site with one default category (A) and a permalink structure using %category%. I want to add a second category (B) (whether a child or not makes no difference here). Initially all posts are in A, and new posts might be in A,B, or Both. The behaviour I observe;

    If a post is in A the permalink is /A.
    If a post is ONLY in B the permalink is in /B
    If a post is in A and B the permalink is in /A (I want /B here).

    If I make B a child of A the permalink is always A (It should be /A/B)

    In order to make an A+B post appear with permalink B, the ID order of the categories needs reversing. WordPress provides no tool for doing that, or migrating posts between categories, so with out an external tool I am stuffed.

    I would suggest that the requirement for ID ordering to properly represent a hierarchical permalink is a bug - the site should not behave differently based on the ID values of the categories, but solely on the hierarchy defined in the dashboard. In the case of a flat structure, WP provides no tools for changing the behaviour as to which category takes priority in determining the permalink because its using a DB key which can't be changed.

    I hope that makes sense!

    The reason for needing this change on my site is because some tools and a fair few wordpress plugins use directory based controls.

  8. esmi
    Theme Diva & Forum Moderator
    Posted 7 months ago #

    f a post is in A the permalink is /A.
    If a post is ONLY in B the permalink is in /B
    If a post is in A and B the permalink is in /A (I want /B here).

    That's not possible. As A is the oldest category, it has the lowest category id and will always be displayed when a post is filed under A & B. If you want the permalink to show B, then just file the post under B.

    I would suggest that the requirement for ID ordering to properly represent a hierarchical permalink is a bug

    It is not a bug. It is part of WordPress core & is by design.

  9. Martyn_
    Member
    Posted 7 months ago #

    Bug or design deficiency. The behaviour makes it impossible to amend the way a site works after its initially constructed - that is poor design.

    I can see other people running into this with google, so I would appreciate to hear what others think...

Reply

You must log in to post.

About this Topic

Tags

No tags yet.