I’m in the process of creating a custom post type for a site I’m working on. This post type will have a hierarchical custom taxonomy.
I know I can add custom fields to the taxonomy pages with acf, my question is:
is there a way to set it up so that child “categories” have different custom fields than parent “categories”?
Thanks for any help
Currently, this is not possible. However, it is very possible to create your own custom location rule!
You could create a rule to look at the taxonomy term’s parent and then return true / false depending on the result.
You can read how to create a custom location rule here:
Hi there @Hube2,
I too have required this functionality today, due to being at work I am unable to test this for a variety of taxonomies although I have used it for shopp-categories.
Please let me know how you get on with this.
Worked a charm, added your code to my custom plugin class for this site. I have not tested it completely, only tested to see if it worked on the parent level so far. Will test the rest as I use it. But after reading the instructions that Elliot linked to and looking at your code I don’t see why it wouldn’t work.
Thanks a heap, saved me a boatload of time trying to figure it out on my own. Now I have an example to follow 🙂
How you could create a rule valid for all post belonging to a subcategory of a main category?
I mean, if I have a structure like this:
– Category 1
– Sub-category 1-1
– Post 1-1-1
– Post 1-1-2
– Sub-category 1-2
– Post 1-2-1
– Post 1-2-2
– Post 1-2-3
– Category 2
– Sub-category 2-1
– Post 2-1-1
– Post 2-1-2
– Sub-category 2-2
– Post 2-2-1
– Post 2-2-2
– Post 2-2-3
I want the post in category 1 have some fields, and the post of Category 2 given different fields
The topic ‘Different fields on category/sub-category’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!