At the top of the All Posts page inside the WordPress dashboard, there is a drop-down which allows us to filter the posts by category. This option however useful has one glaring limitation: we can only filter posts one category at a time.
The option is therefore unhelpful in scenarios where we may want to show posts under multiple categories or posts contain two or more categories. Fortunately, we can still filter the posts using the same workaround I outlined in filtering WordPress posts by tags.
What’s more, we don’t need to install any plugin to do this but instead only need to edit and load URLs in a specific pattern. Here’s how to go about it.
Filter Posts by Multiple Categories using the URL
Login into your WordPress Dashboard and go to the All Posts page. On your address bar type the URL in the following format and press enter: https://www.yourdomain.com/wp-admin/edit.php?category_name=category1,category2,category3
This URL will show posts that have ANY of the three categories, as the comma represents an OR operand. Edit the URL appropriately according to the number of categories you need to filter.
To show posts that have two or more categories, replace the comma with a plus: https://www.yourdomain.com/wp-admin/edit.php?category_name=category1+category2
This URL will ONLY show posts that have both categories, as the plus sign here represents an AND operand.
Filtering Categories with Multiple Words
For any category that has two or more words make sure to separate the individual words using a hyphen this way: https://www.yourdomain.com/wp-admin/edit.php?category_name=category-one
So for instance, if we need to show all posts that have the category Android or Windows Phone, the URL would look as follows: https://www.yourdomain.com/wp-admin/edit.php?category_name=Android,Windows-Phone
On the other hand, to show posts that have both the Android and Windows Phone categories, we would load the following URL: https://www.yourdomain.com/wp-admin/edit.php?category_name=Android+Windows-Phone
I hope that’s clear. If not, please refer to the video tutorial from my YouTube channel that I’ve embedded at the start of the steps. A subscribe to my channel would also be much appreciated!
Hi there,
Can this be done on the frontend?
Hi Richard,
It should be possible to achieve something similar on the frontend with the help of a plugin like Search & Filter. By code I think it can be done using the wp_dropdown_categories function.