Archives by Month

Support this Site!

You may have noticed that there's very little third-party advertising on this site. I'd like to keep it that way. Here's how you can help:

  • Buy my books. They're available at great prices on Amazon.com.
  • Check out my training videos on Lynda.com. It's a great source for "all you can eat" training.
  • Donate a few dollars. It'll help cover my hosting costs and give you a chance to tell me what you want to see covered here.
  • Comment on blog posts. You can help get a discussion going that can benefit others, making the site more valuable for everyone.

Reorganizing WordPress Categories

I do a little end-of-year cleaning.

I decided the other day that some of my blog’s categories were too similar to others (for example, Flying for Hire, Flying for Pleasure, and Flying Lessons) and that I wanted to trim down my category list to make room for new categories in the future. So I combined a few categories and added one.

When I combined Writing for a Living and Writing for Pleasure into one category (Writing), I did it the hard way: I edited all the posts in Writing for Pleasure to use the Writing for a Living category. Then I changed the Writing for a Living category’s Category Name to Writing and the Category Slug to writing. I renamed Writing for Pleasure as a new category called On Blogging with a category slug of blogging. This was extremely time consuming, since I had to modify each individual post and was working from home, with a miserable 256Kbps connection.

For the three flying categories, I decided to get fancy. I changed the name and slug of Flying for Hire, which had the most posts, to Flying and flying. Then I changed the default category (Options > Reading) to Flying. Then I deleted the Flying for Pleasure and Flying Lessons categories, clicking OK in the warning dialog that appeared for each one to allow the default category (Flying) to be assigned to each. This was certainly a faster way to get the job done, but it gave me quite a scare when the number of posts in the Flying category did not increase and the total post count decreased. Had WordPress actually deleted posts? I had to check the contents of that category to make sure I had posts from all three categories in it. I do, but the inconsistent count has me worried, so I don’t necessarily recommend doing what I did to combine categories. Ask me in a week or two and I’ll let you know what I think.

Of course, changing category slugs isn’t a good thing to do when you’re using one of the permalink options (Options > Permalink) to make “friendly” URLs. My changes affected five categories; any links to the old category slugs would break. So I opened my .htaccess file and added the following lines near the top:

Redirect permanent /category/weblog/writing-for-a-living/ http://www.aneclecticmind.com/category/weblog/writing/

Redirect permanent /category/weblog/writing-for-pleasure/ http://www.aneclecticmind.com/category/weblog/writing/

Redirect permanent /category/weblog/flying-for-pleasure/ http://www.aneclecticmind.com/category/weblog/flying/

Redirect permanent /category/weblog/flying-for-hire/ http://www.aneclecticmind.com/category/weblog/flying/

Redirect permanent /category/weblog/flying-lessons/ http://www.aneclecticmind.com/category/weblog/flying/

Keep in mind here that all of the categories I changed are actually subcategories of the Maria’s Weblog category, which has a slug of weblog. Each of these lines automatically redirect the old category URL to the new one. You can learn more about .htaccess at one of my favorite online sources: Stupid .htaccess Tricks.

The net effect of all these changes? Five categories have been combined into two and a new category has been created. My links should continue to work as they did.

Now let’s just hope I didn’t lose any posts or screw up that .htaccess file…

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>