Support » Plugin: SuperCPT » Struggling with hierarchical taxonomies

  • Resolved mattyd247


    Hi, Great plugin but I’m struggling to work out what parameters I would have to add to the Super_Custom_Taxonomy() function in order to make them hierarchical?

    This is my code so far: $tax_materials = new Super_Custom_Taxonomy( 'material');

    Any help would be really appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matthew Boynes


    Hi mattyd247,
    Thanks for checking out the plugin!

    There are a couple of ways to set the taxonomy as hierarchical. The most “core” is that you can pass that as one of the array args when setting up the taxonomy, just like you would in register_taxonomy. Since this attribute is so likely to change, I made a special parameter for it in the class construct.

    $tax = new Super_Custom_Taxonomy( $name, $singular = false, $plural = false, $acts_like = false, $register = array() )

    $acts_like allows you to say this acts like a “tag” or a “category”. Since non-hierarchical (tag) is the default, you’d probably only ever pass it “category” unless you wanted to be explicit. Incidentally, you can even abbreviate it to “cat”.

    So your material construct would become,
    $tax_materials = new Super_Custom_Taxonomy( 'material', 'Material', 'Materials', 'category' );

    You can find the full documentation on this class here:

    Thanks Matthew…. that’s exactly what I was looking for and that works great.

    Keep up the good work

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Struggling with hierarchical taxonomies’ is closed to new replies.