Build Your Own Business Website header image

Community Library Website Case Study – Part 49 – Naming Conflicts in Custom Taxonomies

Difficulty Level -

Filed Under Topics - ,

Listed Under Lesson Subjects -

Applies to - ,

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

This is the 49th in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS) for a Community Library Website. In this lesson we discuss issues that have arisen in the project due to naming conflicts in taxonomy terms.  Ordinarily WordPress handles this, however when importing data using CSV Importer that process is circumvented.  We also change a taxonomy name.

Video Transcript

If you can believe it, this is our 49th episode if you will, or 49th part of our Community Library Website and what I wanted to do in that section is talk a little bit about naming conflicts. One of the things that Pam and I discovered in trying to troubleshoot some data import issues is the importance of unique names in categories and in tags and custom taxonomies. Now WordPress has this nice, little built-in feature whereby if you try to create a duplicate tag or a duplicated named taxonomy term, it will automatically add a number to that. And so, we can see this in my Live Answer topics. If we go over to the dashboard and we look at Live Answer topics, we scroll down here. You can see auto responder has a dash 2 added to it and background images has a dash 2 added to it. That’s because someplace else and it’s probably in my tags, would be my guess, but someplace else, there is another taxonomy term with the term background images. And so, when you create one by adding a new topic, what happens is WordPress automatically makes the name unique.

So let’s go look at tags just real quick and see if that’s really where it is. Tags, post tags… yeah, there’s auto responder. So we already have a post tag called auto responder so you can’t have another taxonomy name term with auto responder so it’s going to have to be auto responder 2 or 3 or 4 or however many. And WordPress does that automatically when you do Add New. The problem arises when you import and when you use the CSV Importer and you’re no longer using the WordPress function for creating these tags or these taxonomy terms, now what you’re doing is you are bypassing that process and you’re adding your own taxonomy terms using you know, my SQL function in that plugin. And so, it’s not smart enough to check for those things and fix them and so, what it can’t do is produce… what it can do is produce a duplicate term which then causes problems.

See Pam asks, “I think WordPress will be smarter if it asked you if you already have the tag auto responder, do you want to choose a unique name?” You know, I suppose that might be helpful. What you can do though is when you are creating it, when you look at the slug because that’s what this is. This is a slug. When you look at the slug, you’ll see that it’s got that number in it and that can be your clue to changing the name. But yeah, I suppose it would be nice if there was a little bit more of that available to you. Nevertheless, we end up with this potential for creating a duplicate taxonomy terms that will cause us problems.

And so, you need to be aware of that when you are creating these taxonomies and these taxonomy terms because this can be an issue. And we’re going to fix that issue in the Community Library Case Study here right now where I have created a custom taxonomy called authors which in fact, is very close to… I’ve given it a name called author and that is the exact name of another taxonomy that’s created by WordPress. And WordPress doesn’t catch the fact that we have created 2 taxonomies with the name of author because it’s not a taxonomy term. It’s actually a taxonomy.

And so… actually, hang on just a second. Somebody suggests that they don’t have any audio. It seems like other people do have audio so yeah, okay. Other people do have audio so Mike, you have a little thing…I’m going to show… actually, I don’t know if this is going to be visible or not. Somebody tell me whether or not they can see my screen, my little on-air showing screen thing, my GoTo Webinar? Okay, got it fixed. Good.

Okay, back to this. So anyway, what we’re going to do is we’re going to change this name from author to item author. So we’re just going to use edit and taxonomy name. Instead of author, it’s going to be item-author. So save the custom taxonomy and now, all of our things are called item-authors and as you may in fact, anticipate here, we are going to need to change some of our code in the custom functions php file in order for us to make this work. But nevertheless…

So anyway, what you want to do is you want to keep… you want to think about that. So for example, we did think about that a little bit early on when we said media type instead of just media. But it didn’t stick well enough for me to catch it with item author. And this can be a problem for example, if you have categories with these same names. You know, you may have created… in fact, that was a problem that we ran into was we ran into a problem where we had categories with the same names as our taxonomy terms. And so, when we went to import the data using the CSV Importer, it broke because we already had a taxonomy term with that term name. So pay attention to term names. Make that they are unique. Make sure that your taxonomy names are unique and don’t make the same mistake that I’ve already made in the presentation here.

0 Comments… add one

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
Subscription Options
0 comments… add one

Leave a Comment