Word press – How to change category name in post links

I recently ran into the issue on this wordpress site. The “Permalink” contained subcategory as “uncategorised” and Edit button didn’t let me change the subcategory.

 

 

Clicking on edit button couldn’t let me change the “uncategorised” keyword.




To solve this I had to go directly into the database and make the changes. Here are the steps you can do to make similar change-

    1. Go to WordPress site’s Dashboard -> Settings -> Permalinks and check which kind of link structure is defined. In my case it was selected as http://www.techoneness.com/%category%/%postname%/. As per this setting I should have got the “category” name in the link but it was coming as “uncategorised” in the link.
    2. Go directly to the database and check “wp_terms” table. This table contains the slug for each category and if this term is something different than the actual category name, it causes the permalink to appear wrong. In my case “uncategorised” was mentioned as slug for “Java”.

      Wrong slug name
    3. Update “wp_terms” table to change the slug to reflect the right value.
      UPDATE  `i674588_wp2`.`wp_terms` SET  `slug` =  'Java' WHERE  `wp_terms`.`term_id` =3;
      
    4. This query would change the slug and hence the permalink.




Leave a Reply

Your email address will not be published. Required fields are marked *