WordPress.org

Ready to get started?Download WordPress

Forums

Media Categories 2 - not saving correctly when two categories with same name (8 posts)

  1. yedidel
    Member
    Posted 2 years ago #

    I am using Media Categories 2 to tag my attachments.

    However there is a big problem. I have two sub-categories with the same name - different parent, different slug, different ID etc.
    If I edit an attachment that is tagged with one of these categories, do not change anything and saves, it tags it with the other category instead, which unlinks it from the page I want to show it...

    http://wordpress.org/extend/plugins/media-categories-2/

  2. Eddie Moya
    Member
    Posted 2 years ago #

    Just so I'm clear on your situation as I look into this,... are you using this plugin out-of-the-box, or have you made use of the filter and chosen some taxonomy other than categories?

    You said you were using it to "tag" your attachments, so I'm wondering if your using post_tags or some other taxonomy.

  3. yedidel
    Member
    Posted 2 years ago #

    No, I am using it out of the box.

  4. yedidel
    Member
    Posted 2 years ago #

    anything new?

  5. Eddie Moya
    Member
    Posted 2 years ago #

    Sorry for the slow reply - ive been away from work a while due to the NATO summit here in Chicago.

    I have managed to duplicate the error your describing. It occurs when two categories with the same name are chosen for an attachment. The reason is the way WordPress tries to handle taxonomy terms when they are assigned to an attachment. The plugin saves the slugs, but for some reason, when you refresh the page, it changes them to the Name. When the names collide, it just eliminates one of them.

    I have not had time to try to resolve this yet - but I intend to do so by the end of the week.

    Thanks for your bug report, I probably wouldn't have caught this one on my own.

  6. yedidel
    Member
    Posted 2 years ago #

    Thanks.
    Anyway - it happened to me when I chose only one, and when saving it reassigned to the other, not when I chose both.

  7. Eddie Moya
    Member
    Posted 2 years ago #

    Good to know. I think whats happening is when it grabs the category by name, it just looks for which ever category comes first with that name in the query response.

    Thanks again.

  8. Eddie Moya
    Member
    Posted 2 years ago #

    After looking in more detail, its clear that the problem is how WordPress handles taxonomies when they are assigned to attachments (which they normally aren't).

    I've submitted at core trac ticket in hopes of solving this within WordPress.

    That will not be very soon however, so until then I've devised a workaround to the problem and released it as Media Categories 1.3.1

    Let me know if this solves you problem and if you have any others.

    Thanks again for the bug report! This sort of thing really helps me to justify open source in a corporate environment.

Topic Closed

This topic has been closed to new replies.

About this Topic