Categories
Technology

Issue with WordPress & Tags/Categories

So I recently returned to my blog and have started updating a bunch of content.

What I’ve done is left Facebook… took a dump of my data from there and am now back-filling it to my blog.

I used to blog all the time, which you can see from the archives, so I have a very old base installation of WordPress that has been upgraded over the years.

At some point, WordPress has combined the Tags and Categories sections of the site into a single table, and they have a joining table that says which is what type of thing, either a Tag or a Category.

Well somewhere along the way it would create duplicates of these, while I never really looked under the hood of the database structure previously, I reckon they probably had one table for tags and another for categories, but as I said above, they have now combined these and the duplicates are causing issues.

In my case, I had something like 209 posts using the category: “Photography” and I had 3 using the tag: “Photography”, when they merged them one of the the items was not copied over and only the one with a 1 after it was copied over… so the slug for Photography example, was “photography1”.

The Issue

When I tried to use this term as a tag or a category I would get the error “Sorry, you are not allowed to assign the provided terms.”.

When I tried to edit the category or term I would get an error which reads “You need a higher level of permission.”, but I am already the admin for the site.

The Fix

It requires access to the database for an easy fix.

  1. Go to the “terms” table. Add a new entry for the problematic term. Give it a unique slug, and save.
  2. Jot down the ID that was just assigned.
  3. Go to the “wp_term_taxonomy” find the two entries for your term and modify one of them to change the term_id to the newly created id.
  4. Do this for each term that is causing you issues, because the odds are it will be because the same terms has a record for both “category” and “post_tag” in the “wp_term_taxonomy” table.

Once done you should be right to go.

Thankfully WP uses yet another table “wp_term_relationships” so the posts that had the tags should retain them and same with categories if it was the category you changed.