When working with posts in your WordPress admin area, you might be looking for a way to filter your posts. By default, WordPress includes a few filter options via dropdown menus at the top of the page. You can also filter posts by clicking on the name of a category, tag or author.
Show Categories, Tags & Authors in Screen Options
Before you can click on various links on your “Posts” screen to filter them, you need to make sure they are displayed in your list of posts. Look in the top-right corner for “Screen Options,” and make sure Author, Categories & Tags are checked.
This is somewhat limiting, however, because you can only filter by one single option at a time. The exception is if you use the dropdowns at the top, you can filter by both Month AND Category. But you’re still limited to only ONE category and ONE month.
Some examples of more complex filtering could include:
- View posts with a specific category OR a specific tag
- View posts in any one of 3 different categories
- View only published posts by one author
- View drafts in a particular category, only by one author
- View scheduled posts to be published in January 2015
Query Parameters
When you click on “Published,” take notice how your URL changes. It will look like this:
http://yoursite.com/wp-admin/edit.php?post_status=publish&post_type=post
Explaining query parameters in detail is beyond the scope of this article, but you can probably understand what is happening here. Query parameters are being used to filter posts. In this example, post_type=post
is only displaying posts (not pages, or any other custom post type), and post_status=publish
is only displaying published posts (not drafts or scheduled posts).
Similarly, if you click on the name of one of your categories, you’ll see a URL like this (I clicked on “Plugins”):
http://yoursite.com/wp-admin/edit.php?category_name=plugins
List of Query Parameters You Can Use
Using a bunch of different query parameters, you can create your own variations for more complex filtering. You would enter a custom URL into your address bar to achieve your desired filtering. Here’s a list of all the query parameters that you can use, along with what each one means.
As long as your URL starts with this, you can use all of the following parameters:
http://yoursite.com/wp-admin/edit.php
Query Parameter | Possible Values | Description | Allow Multiple? |
---|---|---|---|
post_type |
post page {custom-post-type} |
The type of content or post type | NO |
post_status |
all publish draft future trash |
The post’s status. “Future” will show posts that are scheduled to be published in the future. | NO |
author |
{ID} | The author’s ID | YES |
category_name |
{category-slug} | The category’s slug | YES |
tag |
{tag-slug} | The tag’s slug | YES |
m |
YYYYMM | Month: Must be entered in the format YYYYMM. Ex: 201401 for January 2014. |
NO |
show_sticky |
1 | Shows posts marked as “sticky.” You either use it with a value of 1, or don’t include it at all. | NO |
Allow Multiple
If we’ve indicated that you can filter using multiple values, you can do so using commas between values in your URL. (Refer to the table above)
If you want to view all posts in the “Plugins” OR “WordPress Admin” categories, use the following:
http://yoursite.com/wp-admin/edit.php?category_name=plugins,news
You can do the same thing with tags. To view all posts with either the “Keyboard Shortcuts” OR “Sass” tags, use the following:
http://yoursite.com/wp-admin/edit.php?tag=keyboard-shortcuts,sass
To view posts by either author 1 OR author 3 (1 and 3 are the author’s ID), use the following:
http://yoursite.com/wp-admin/edit.php?author=1,3
OR vs. AND
Using commas between values will find posts in either one OR the other. To find posts with BOTH value 1 AND value 2, use the plus sign (+). For example, to find posts with BOTH tags “keyboard shortcuts” AND “sass”:
http://yoursite.com/wp-admin/edit.php?tag=keyboard-shortcuts+sass
Combine Multiple Filtering Options
You can combine several filtering options all at once. For example, you could view posts:
- scheduled to publish in the future (
post_status=future
) - with either the “WP Engine” or “Hosting” tag (
tag=wp-engine,hosting
) - by either author 3 or author 4 (
author=3,4
) - only in January 2014 (
m=201401
)
http://yoursite.com/wp-admin/edit.php?post_status=future&tag=wp-engine,hosting&author=3,4&m=201401
We Recommend
https://kinsta.com › wordpress-hosting
Fast and secure infrastructure, worldwide CDN, edge caching, 35 data centers, and enterprise-level features included in all plans. Free site migrations.
https://gravityforms.com › features
Create custom web forms to capture leads, collect payments, automate your workflows, and build your business online. All without ever leaving WordPress.
Leave a Comment