The long awaited WordPress 2.5 has been available for a month or so now. I took the risk and updated this blog as soon as they released it. Overall I am very impressed, I think the new design looks, feels and works great. I have however encountered two small issues that can be a problem for both designers and bloggers. I am sure these issues will be resolved in future versions (I’m currently running on WordPress 2.5.1), but until then I’ll point out what the problems are, as well as give you quick work-arounds for them.
This post will explain the first problem, and that is that the manage categories screen doesn’t display the IDs of the categories ad it used to in previous versions of WordPress.
The Problem
The first problem is very minor and probably more applicable to WordPress designers/developers. When designing a theme you can include/exclude certain categories in different parts of a theme. Let’s say for example you want the main loop on index.php to display all posts except those in a certain category. This can easily be achieved using the query_posts() function. Like this:
Easy enough. Lets say the category you want to exclude is called “Apples”. What you *should* be able to do is go to the manage categories screen in the WordPress admin panel of your site/blog. There will then be a table listing all your categories. In older versions of WordPress, the first column in that table was ID. But not in 2.5. Take a look at the image below:
The ID column is not there. What to do?
The Solution
The long way to find the ID is to log into PHPMyAdmin, or any other database manager and look for the ID in the categories table. But that’ s a bit of a mission…
Not to worry, there is a quick workaround. Simple hover your mouse over the name of the category of which you want the ID, in this case hover over the word “Apples”. Then check your status bar:
Problem solved. You can now use the category ID to exclude/include it wherever you need. Like I said, ths is a very minor problem and should be really easy to fix for the WordPress team (it’s a case of just calling the ID field from the database) and we should see a fix for this soon.
In my next post I will point out a problem with saving custom fields n WordPress 2.5, as well as give a workaround for it. Stay tuned…
Ross
15-05-2008 at 11:33 am // PermalinkInteresting, and an unusual oversight by the Wordpress gang.
Maybe they did that as it didn’t mean much to the average joe, but I hear you on the developer’s side of things.
Richard X. Thripp
16-05-2008 at 3:01 am // PermalinkI wouldn’t be so quick to call it a “problem” needing to be “resolved”; the developers probably removed it to declutter the page, and most people don’t care about database ID codes. The people who are filtering by category ID like that already know to check the URI.
Cobus // AUTHOR
16-05-2008 at 9:04 am // Permalink@ Richard X. Thripp: Thanks for the comment
I understand what you mean, and I agree that it declutters the page. And for people who know to chek the url, it’s really no biggie.
However, I have often needed clients to give me the ID’s of certain categories when designing a theme for them. And they sometimes had a problem knowing what I was talking about, even while using older version, which still had the category ID’s.
I personally wouldn’t mind if they left it this way, but I thought I would point it out to those who where unaware.
Richard X. Thripp
17-05-2008 at 12:14 pm // Permalink@ Cobus: Fair enough. I’d keep the category IDs too, and the old layout on the write screen; seems they’ve over-simplified a bit.
If your clients’ web sites are live, and the categories are listed in the sidebar, you can get the IDs yourself from the source code of the page; there will be a tag saying li class=”cat-item cat-item-219″ (219 will be the cat. ID). Maybe you can avoid asking them then.
Dale
19-07-2008 at 1:59 am // PermalinkThanks for this tip about finding the category ids. I use the del.icio.us daily blog posting function to automatically post bookmarked links to my site, and it requires a category id number to assign the post to a category. I didn’t know how to find it anymore after upgrading to WP 2.6….
Regards,
Dale
Cobus // AUTHOR
28-07-2008 at 10:18 pm // Permalink: Awesome! I’m glad you found the post helpful!
Aless{a}ndro
28-07-2008 at 11:35 pm // PermalinkHello, thank you for advice. But I have a problem. If exclude a category, the remaining messages will be displayed in ASC order and not DESC, so the last written message is not shown on top of the list but at the bottom. can you help me?
i’ve wp 2.5.1 with default theme.
bye
Cobus // AUTHOR
11-08-2008 at 10:04 am // Permalink{a}ndro: Try adding ‘&order=DESC’ to your query. That should do the trick
Hamza
14-08-2008 at 11:01 am // Permalinkwhen creating a CMS Over a Wordpress with only customizing a theme . we need this ID . though many Magazine Theme Depends ON it .
how ever , many wordpress themes designer may not need it , till they need to customize the home page , or using a certain category page template as
category-7.php , category-22.php . though it needed in wordpress theme design itself .
one more thing i used to get the Category ID’s from the links in the browser as u did . but the it’ll not bother the wordpress developers to add this column back to the wordpress 2.5,2.6 again .
however it’ll be more useful as using wordpress as a CMS . ( at least for Developers and wordpress theme designers )
Nice Tips Thank you
AboutOnlineTips
09-09-2008 at 2:01 pm // PermalinkThat was a super trick..Thanks Dude
Pradeep
07-10-2008 at 12:53 pm // PermalinkHey that was quite helpful. I was looking for a way to identify the category IDs and the workaround you offered helped me instantly
Web-Betty
15-10-2008 at 7:29 pm // PermalinkAwesome. Thank you!
Alex
29-10-2008 at 6:59 pm // Permalinkwow, THANK YOU
Luke
12-11-2008 at 3:13 am // PermalinkThanks for this article - as a relative newcomer to Wordpress I’ve been struggling with the Category ID and where to find or change it. This will definitely help!
Thanks again, Luke
Jason Stanley Marshall
29-11-2008 at 2:45 am // PermalinkI fall into the category that Hamza mentioned… the magazine style theme dependency. It displays certain themes in certain spots on the main index page. Not only do I need to know the cat-id but I also need to be able to change it. I guess the other solution is to change it in the code to match the id that was assigned to the category. If you have any other ideas let me know.
Jason