List filters
3 min read
With a Pro license, every field column on the posts, pages and custom post type lists and on the users list gets a filter control above the table. A filter narrows the list by the field's value, using the same real database columns as Query posts by field value.
Which fields get a filter
A field gets a filter when it has an admin column (Show in the admin list) and its type is one of these:
Field type | Control | Placeholder or first option |
|---|---|---|
Select, Radio buttons, Button group | a dropdown with the field's choices | "{Label}: any" |
Checkboxes | a dropdown with the choices; matches items that contain the chosen value | "{Label}: any" |
True / false | a dropdown with Yes and No (or the field's on and off labels) | "{Label}: any" |
Number, Range | two number boxes | "{Label} from", "{Label} to" |
Date | two date pickers | "{Label} from", "{Label} to" |
Date and time | two date-time pickers | "{Label} from", "{Label} to" |
Time | two time pickers | "{Label} from", "{Label} to" |
Text, Text area, Email, URL, WYSIWYG, Color picker | a search box; matches values that contain the text | "{Label} contains" |
Image, File, Gallery, Repeater, Flexible content, Clone, Link, Map, relational fields and Password have no filter.
Use the filters
- Open the list (for example Posts › All Posts).
- Set one or more filters above the table. On the posts list they sit next to WordPress's own filters (dates, categories).
- Click WordPress's Filter button. On the users list the filters have their own Filter button.
The filter values are added to the page address, so you can bookmark or share a filtered list. They combine with each other and with WordPress's own status, search, author, date and category filters: a post must match all of them.
Details:
- Choice filters only accept the field's current choices. A value in the address that is not a choice is ignored.
- True / false: "Yes" matches posts where the value is on. "No" matches posts where it is off and posts that have no value yet.
- Ranges use "greater than or equal" for the first box and "less than or equal" for the second; you can fill only one. A date range includes the whole last day; a time or date-time "to" value includes the whole last minute.
- Number boxes need a number; date boxes need a real date. A value that does not parse is ignored (no error and no filtering by it).
- Text filters use "contains" and take up to 200 characters.
- Up to 28 conditions are applied in total (a "No" on a True / false field uses two). More filter values than that are ignored from the last field on.
- Empty filter boxes are not added to the address.
The same filters narrow the CSV export of the list (see CSV export).
Users list
On Users the filters come from groups that have a User role or User form rule. They work on the users shown by the list, together with its role links and search. Sorting by a field is not offered on the users list.
Developer filter
wpmcf/admin_columns/filterable (arguments: enabled, column descriptor, field, kind) lets a site switch the filter of one column off by returning false.
Without a license
On the free plugin, or when a Pro license has expired, the filter controls disappear and an address that still contains filter values is not applied. Columns and sorting stay.
Troubleshooting
- I do not see a filter. The field needs Show in the admin list, the group must feed this list (see Admin columns), the field type must be one in the table above, and the license must include admin columns.
- I filtered but the list did not change. Click Filter. A value that is not valid for the field (a date in another format, text in a number box) is ignored.
- "No" shows more posts than I expected. It includes posts that have no value for that field.
Still stuck? Contact support