At the top of the WordPress All Posts page, there’s a drop-down which allows you to filter posts based on a category. One can however only filter by one category at a time, though it is possible to filter post by multiple categories by editing the URL.
Currently, however, no such drop-down exists for tags. Nevertheless, it’s still possible to filter posts based on tags using one of two methods:
- Using the tags column
- Using a tag filter URL
1. Filter Posts by Tags using the Tag Column
This will allow you to filter the posts by tags, but only one tag at a time. To filter by multiple tags, check the second option below.
- First, we need to enable the Tags column which is not displayed by default. In the All posts page, click the Screen Options tab, and put a check-mark on the Tag option then Apply.
- Once the column is revealed, click on any tag to show only posts that have that tag.
- To remove the filter, click on the All link just below the Posts title.
2. Filter Posts using a Tag Filter URL
You can also filter posts based tags by loading a URL in the following format:
So for instance, if you want to show only posts that contain the tag WordPress, then you would load the following URL:
For a tag containing multiple words, use a hyphen to separate the words. e.g. for the tag WordPress Tutorials you would load:
Use a plus sign to separate tags if you want to filter posts by multiple tags. For instance, to filter all posts that have the tags WordPress and Blocks, you’ll use:
Use the same principle to filter posts with three or more tags. However, please note that the plus sign here acts like an AND operator, which means the URL will load posts that contain both tags and not just one of them.
To show all posts that contain either of the tags use a comma instead of the plus as follows:
The comma here acts like the OR operator so it should load all posts that have any of the tags. WordPress will encode the comma to its Unicode equivalent (%2C) once it finishes loading. As such, you can also use %2C instead of the comma i.e.
For both cases above, don’t forget to add hyphens for tags that contain multiple words, e.g.
Now, here’s a bonus trick for you: all the above also works for Categories, so you don’t have to be limited to filtering posts to just one category using the dropdown.