Written by Jeffro On April 27, 2008 | Category Of Post (wordpress) | 354 views |

The WordPress 2.5 Tag Manager

While cruising through my administration panel today, I decided to take a look at the Tag Manager. The tag manager allows you to view all of the tags that are within your WordPress database. From here, you can delete tags, add tags or search your tag repository. You can even view all of the posts that a tag is associated with.

Well, my discovery lies in the fact that I found at least 20-30 pages of blank tags. To illustrate what I mean, check out the following screen shot.

Blanks Tags In The Tag Manager

I had no idea why there were 20 pages of blank tags. So after finding a blank tag that was attributed to a blog post, I discovered what the problem was.

Blank Tag Culprit

Notice how there is a comma which appears to be a tag itself. In WordPress 2.3.3 to WordPress 2.3, you had to type in the tags altogether in a horizonatal list. What I discovered back then was that, after you typed in your tags and clicked the save button, WordPress would rearrange your tags into alphabetical order. Depending on the tags that I had used and where the comma was located, the reordering of tags would sometimes place a comma at the very beginning of the tags. This was annoying but I dealt with it.

Now it looks as though I can delete all of those pesky comma tags from my WordPress install thanks to the tag manager. However, I’ve run into another issue. At one point, I reformatted my blog which caused some errors with the tags as the exporter had a problem exporting the correct tagging structure. This caused the import to only import tag ID numbers. This was fixed in a later version of WordPress but in the tag manager, this is what I see.

Tags As ID's

If I click on any TAG ID number, the Tag name and the Tag slug end up being the same thing, the TAG ID number. I have no idea if on the front end of WordPress, these ID’s are represented by their true value or if these numbers are meaningless, allowing me to delete them from my tagging structure.

If anybody else has experienced this within their tag manager, let me know.

This Post Was Tagged With:



4 Comments posted on "Interesting Discovery Using WP Tag Manager"
phil.gs on April 27th, 2008 at 9:44 pm

You can always take a look at the database and see what those tags are used for. It may sound scary, but it’s really not that bad. Just be sure to do a full backup first (I accidentally deleted the right table from the wrong database once). Let me know if you need any help.

Fredelig on April 28th, 2008 at 2:15 am

I had the same thing after upgrading to 2.5. Only one “empty” tag, though. I’m sure I had made it myself without knowing it. I decided to take a chance and closed my eyes while pressing “delete” in fear that it would ruin my whole DB. Luckily it all went well. :)

Jeffro on April 28th, 2008 at 4:53 am
@phil.gs What would I be looking for, the actual tag id number and then matching it up with the ID number inside the database?

@Fredelig Sounds like you didn’t screw up your tags as badly as I did. Weird stuff. I’m going to try and delete all of these weird and empty tags later today and see what happens.

phil.gs on April 28th, 2008 at 10:15 am

@Jeffro There’s a good explanation of the taxonomy tables in the Codex. You can look for the tag id number in the term_id column of the wp_terms table and see if there’s a slug or name associated with the tag (there’s probably not).

Look for the tag number in the term_id column of wp_term_taxonomy and note the corresponding term_taxonomy_id. It’s the same as the term_id in my database, but YMMV. Then look for the term_taxonomy_id value in the wp_term_relationships table. The corresponding object_id is the ID of the post associated with that tag. If the tag is on multiple posts, then there will be multiple rows with that term_taxonomy_id.

Here’s a SQL query you can run in phpMyAdmin or whatever to make it much simpler:

SELECT tr.object_id, tr.term_taxonomy_id, tt.term_id, tt.taxonomy, tt.count
FROM wp_term_relationships AS tr
JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE tt.taxonomy= 'post_tag';

Now you can just find the tag id in the tt.term_id column and the tr.object_id column will give you the post ID. Plus the tt.count column will tell you how many posts are tagged with that tag.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.

Name: 
Email: 
URL: 
Your Comment: 
Powered By WordPress

website stats
© 2006 - 2008 Jeffro2pt0
Sitemap / Site Stats / Poll Archive

Wearing A Hacked And Slashed Version Of The Resolution Black Skin for Shifter by Buzzdroid

Close
E-mail It