Skip to content

Taxonomy - field dependency

Show and hide custom fields according to the category that is chosen, so a trailer listing is never asked for its mileage and a VIN filter only turns up once a visitor is browsing cars.

2 minute read

Field dependency lets you show and hide specific fields on the search form and on the form for adding an ad, depending on the selected terms of a taxonomy.

Enable field dependency

  1. 1 Open the custom fields list

    Go to Listivo Panel → Custom Fields and click Add New Field. To set the dependency on an existing field, skip the first two steps.

    WordPress admin with Custom Fields open under Listivo Panel and the Add New Field button highlighted
  2. 2 Name the field and set its type

    Enter your field name and set Type to Taxonomy. Only this field type offers the dependency option.

    Add New Field form with a name typed into the Name box, Type set to Taxonomy, and the Add Field button below
  3. 3 Edit the new field

    Find your new field in the custom fields list and click Edit.

    Custom fields list with the Edit button on the Category row highlighted
  4. 4 Tick Field dependency

    Mark the checkbox next to Field dependency and save your changes. Edit the field again and the relations table is waiting for you.

    Edit Field screen for the Category field with the Field dependency checkbox ticked at the bottom, below Multilevel, Search Logic and Allow Multiple Values

Reading the relations table

Across the top (1) are the category names; the first column (2) lists every field you can set a relation with.

By default the entire table has empty checkboxes. A row with no checkbox marked means the field is visible for every category, and so does a row with every checkbox marked (ex 1).

In the second example (ex 2), the fields are visible only in the categories you selected: Mileage is not visible for trailers, and Motorcycle features are visible only for motorcycles.

Hidden means hidden for everyone
Field dependency applies to the adding page and to the listing page. A field you set as invisible is not shown to any user.

On the form for adding an ad

Below is the form as it looks for trailers. Mileage and transmission are nowhere to be seen.

On the search form

What is the difference between a row left empty and a row fully marked? A field whose row has no checkbox marked is on the search form immediately. A field whose row has every checkbox marked appears on the search only after a category has been picked.

The Make field is on the search form from the start. The VIN field is not.

The VIN field turns up once one of the categories is chosen — the car category, in the example below.

In short
  • Field dependency is set per taxonomy field, in a relations table of categories against fields.
  • A row with no checkbox marked, or with every checkbox marked, keeps the field visible for all categories.
  • An empty row puts the field on the search form straight away; a fully marked row holds it back until a category is chosen.
  • A field hidden for a category is hidden from every user, on the adding page and the listing page alike.

Ask the people who build MyHome

We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.

Was this guide helpful?