How to hide taxonomy when adding a post?

Hello.
There is the type of record + 3 to it taxonomy, each taxonomy is a city and a category to it
post type - company
taxonomy - moscow
taxonomy - spb
taxonomy - omsk

When adding a post is displayed 3 taxonomy and select the category, it is not convenient and not aesthetically pleasing.
We want to make sure: when adding a post, you select a city (taxonomy) and then displays a list of categories.
There is the Pro version of acf, I tried to play with it, but we don't even know in which direction to look. Give advice or point in the right direction:) thanks

5e977ec4c15f7038532497.png
April 19th 20 at 12:14
1 answer
April 19th 20 at 12:16
Solution
You pogamat conditional rules.

Create one field with the choice of taxonomies (cities). It can be a field of type select, radio, checkbox - depends on whether you need to choose one or several cities. In this field add all of your city/taxonomy. You can do it manually, and it is possible to programmatically fill from existing taxonomies.

Then under each taxonomy (city) create your own field of type Taxonomy, which will be selected the terms. Enable this box to show the Create Terms, Terms Save and Load Terms, and include Conditional Logic - this is the whole magic. Now in the conditional set condition. That's how it looks:

5e9820dca3b3f788190769.jpeg

And that's how it looks on the edit page of the record - by default, city is not selected:

5e9820f420767468763297.jpeg

And if you chose the city - showed the box to select categories in that city:

5e9821140e5ab394583256.jpeg

Here you export this test group fields, impartite yourself in ACF and pogovarit:

[
{
 "key": "group_5e981df6cbdcc",
 "title": "Taxonomies",
 "fields": [
{
 "key": "field_5e981e4bb1454",
 "label": "City",
 "name": "taxonomy",
 "type": "checkbox",
 "choices": {
 "spb": "SPB",
 "msk": "Moscow",
 "omsk": "Omsk"
},
 "layout": "vertical",
 "return_format": "value",
},
{
 "key": "field_5e981e18b1453",
 "label": "MSK",
 "name": "term",
 "type": "taxonomy",
 "conditional_logic": [
[
{
 "field": "field_5e981e4bb1454",
 "operator": "==",
 "value": "msk"
}
]
],
 "taxonomy": "post_tag",
 "field_type": "checkbox",
 "add_term": 1,
 "save_terms": 1,
 "load_terms": 1,
 "return_format": "id",
 "multiple": 0,
 "allow_null": 0
}
],
 "location": [
[
{
 "param": "post_type",
 "operator": "==",
 "value": "post"
}
]
],
 "menu_order": 0,
 "position": "side",
 "style": "default",
 "label_placement": "top",
 "instruction_placement": "label",
 "active": true,
}
]
thank you very much, this is brilliant:) - breanne_Kozey commented on April 19th 20 at 12:19
@breanne_Kozey, cheers :) - jalyn_Hue commented on April 19th 20 at 12:22

Find more questions by tags WordPress