Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Changing Taxonomies Leads to Duplicates #12

Open
jcrawford opened this issue Jan 7, 2020 · 3 comments
Open

Changing Taxonomies Leads to Duplicates #12

jcrawford opened this issue Jan 7, 2020 · 3 comments

Comments

@jcrawford
Copy link

I have noticed that when I have a category named 'Fun' and a tag named 'Fun' if I try to change the taxonomy of the category to become a tag then I end up with duplicate named tags.

For instance if my post count is such.

Category Fun: 30 posts
Tag Fun: 10 posts

The end result is that I have two tags for Fun such as the following

Tag Fun: 30 posts
Tag Fun: 10 posts

Is this a bug or is the plugin meant to duplicate the tags? I would have expected it to look for a term within the new taxonomy that matched the name of the old taxonomy term and then if one was found to use that one rather than creating a second. With this issue in place it is leaving me no option but to use the hook 'term_management_tools_term_changed_taxonomy' and try to merge them together after the fact.

@jcrawford jcrawford changed the title Changing Taxonomies Changing Taxonomies Leads to Duplicates Jan 7, 2020
@jcrawford
Copy link
Author

I can only assume this is a bug because WordPress core throws an error if you try to add a tag with a name that already exists, yet this plugin will create a secondary duplicate term even if it already exists in the new taxonomy.

@scribu
Copy link
Owner

scribu commented Jan 7, 2020

I'm not sure why it does that. It doesn't seem ideal.

A better UX would be to let the user decide what they want to do:

The tag already exists in the destination taxonomy.

Would you like to merge the old tag in?

[Merge] - perform a merge (already implemented in a different part of the plugin)
[Cancel] - do nothing

@theMikeD
Copy link

The change taxonomy operation currently does not consider any terms that already exist. This is by design: the terms simply have their associated taxonomies set directly using a $wpdb command. So this is not a bug, but a feature request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants