Help Center

How to Create Admin FIlters for the Custom Post Type

How to Create Admin FIlters for the Custom Post Type

With JetEngine Admin Filters, you can create back-end filters for the Custom Post Type. To do it, please, follow the next instruction.

Before you start, check the tutorial requirements:

admin filter in the post type

Head to WordPress Dashboard > JetEngine > Post Types. Find the needed Post Type and edit it. 

After that, scroll down to the Admin Filter tool and click “Add new” in the Admin Filters section.

The basic setup is over; now, let’s create a specific filter type.

Create Admin Filters for Posts by Taxonomies

This filter type helps the admin to sort posts by taxonomy assigned to the needed Custom Post Type. Follow this tutorial to learn more about How to Create a Custom Taxonomy.

For example, there is a “Room” post type, and we need to filter rooms by the “Room Types” taxonomy. 

Once the Admin tab in the Custom Post Type is opened, set the Name/Placeholder for a filter and select the “Filter by Taxonomy” option in the Type dropdown. Then, don’t forget to pick the needed Taxonomy by which posts will be filtered.

filter by taxonomy

To change the categories display order in the filters, enable the Show Counts feature and set the “From highest to lowest values” Order.

setting order

Build Admin Filters by Meta Data

Glossary option source

Firstly, create a filter with the “Filter by meta data” Type.

filter by meta data settings

Now to filter by specific meta field, select it from the list.
To pull the labels from the glossary, choose the samely named item in the Options Source drop-down and pick the needed glossary from the Glossary list.

glossary options source
Warning

Mind that if you use the date timestamp field, there can be issues with its data display. Read more about it if you are Unable to Display Date Field in the Admin Filters Properly.

In the following picture, you may see configured admin filter:

admin filter configured

Save the changes and check the results.

glossary admin filter

Field options source

Now we will create another admin filter, but the “Select from database” or “Field options” configuration will be used in the current case. It depends on the meta field type.

This option pulls the value out of the meta field from each post that has a value inside the selected field.

In this example, a filter is by the text field, which shows a cost for a specific room according to the Custom Meta Field key.

filter by meta data settings

The same result can be achieved by selecting the exact meta field from the list. You may see the configuration in the picture below.

filter by meta field

In this case, we should choose the “Select from database” Options Source. This option can be different depending on the meta field type you will use.

select from database options source

Now let’s check the result.

admin filter by meta field

To create this filter type, you should create a relation first. Please follow the How to Create Relationships Between Posts tutorial. 

Now we will create a filter for “Orders” Custom Post Type by related “Room” posts. 

Select the needed filter Type and choose the Relation by which posts will be filtered.

filter by related items settings

Save the changes and check the results.

filter by related items

That is it. The admin filters are set. Now you know how to create the admin filters for your Post Types.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.