Go to Posts -> Edit in the WordPress Admin area and you’ll see a list of all the posts you have. There is a dropdown list called View all categories, which allows you to select a single category to view posts from. But…
What if you want to view posts from more than one category, or better yet, want to exclude posts from certain categories? Can’t do it right? Well not through the WordPress interface, but you can do it through URL parameters.
Finding Out Your Category Numbers
To make this work, you’ll need to know the category numbers for your categories. You can find these through either of the following two methods:
- Go to Posts -> Category screen and hold your mouse over the category in question. In your browser’s status bar you will see a URL which ends in ID=xx (xx is the number of the category).
- While still in Posts -> Edit, select the category you want in the dropdown list and click Filter. You’ll be taken to a page showing only posts from that category. In the browser’s address bar you’ll see that the URL contains cat=xx (xx is the number of the category).
The first method is quicker if you want to look up multiple category numbers (you may want to write them down). The second method is better if you’re just after one or two category numbers – you’ll need to do this step anyway.
By default, the Posts -> Edit screen has a URL that ends in wp-admin/edit.php with no parameters, eg:
Rather than typing all the parameters, it makes sense to start with a URL that includes them.
If you haven’t already, select one of the categories you want to include / exclude in the dropdown list and click Filter. You’ll be taken to a page showing only posts from that category, but you will now have a URL that looks like this:
We’re going to be changing the cat=xx part of the URL.
Displaying Posts From More Than One Category
Perhaps I want to display posts from more than one category – in my case, I may want to see all the posts from my WordPress and Web Development categories, but not from the rest of my categories (too much noise).
Easy. Simply edit the URL and change the cat=xx to cat=xx,xx (where xx is the category numbers that you want). In my case, I change the URL to the following (note the cat=4,65):
Want posts from three categories? That’s right:
You’ve got it now!
Excluding Posts From Certain Categories
It’s also possible to exclude posts from certain categories from appearing in the Posts -> Edit screen.
Why would I want to exclude posts from certain categories? Actually, that’s how I started looking into this issue. I haven’t been posting much recently and, as a result, my weekly automatic lifestream digest posts pretty much filled up the screen:
I was having trouble seeing my real posts!
Thankfully it’s easy to exclude the category that these posts are in. Simply edit the URL and change the cat=xx to cat=-xx (where xx is the category number you want). In my case, I change the URL to the following (note the minus sign, eg: cat=-92):
Want to exclude posts from more than one category? That’s right:
That’s all – it’s a fairly long post for a fairly simple tip. It’s probably not something that will be needed often, but in some circumstances it’s very useful to have greater control over which posts appear on the Edit Posts screen.