WordPress Is An Ever Changing Beast

Post written by: Mike

I was working on hardcoding some things in the theme to one of my other WordPress blogs to reduce the number of database queries. I decided that I rarely change my Blogroll so I should just hardcode in the values.

While in the area, I noticed that the theme listed the number of posts next to each category name. I decided to get rid of the count but was unfamiliar with how that function worked. The theme used the function wp_list_cats() so I fired up the old WordPress Codex and started searching.

To my shock, I discovered that this function has been deprecated starting with WP 2.1 and we should all be using wp_list_categories() instead. Who new?

I made the change to the new function and got rid of the argument that displays the post counts for each category (show_count=1 if you decide that you want to turn that on).

I didn’t notice any blazing performance gains or really any changes at all but I guess at least I am safe if they decide to really get rid of wp_list_cats() for good in a future upgrade.  If you have been upgrading WP for a while without really taking a close look at your theme, you might want to make sure that you are not still using the wp_list_cats() function to display your category names.

1 comment so far ↓

#1 Matt Keegan on 07.26.07 at 3:38 pm

I have learned (often the hard way) that every WP update has some surprises to it. Plug-ins no longer work, a theme looks disjointed, something appears out of whack. So, I’ve gotten in the habit to check for plug-in and theme updates as they are often made soon after a new WP release.

Leave a Comment