Page 1 of 1

How to View Taxonomy

Posted: Sat Jan 18, 2025 5:53 am
by sakibss
And here we are! By copying/pasting the previous code you will be able to create your first taxonomy ! As you can see, just like with CPTs, we have two very special arrays. The first one is called $labelsand will contain all the words that will be used and translated (if the text_domainindicated is correct) inside our backend.

The most interesting part happens inside the array $argsthat contains all the configurations needed to create the taxonomy (including the array itself $labels):

labels– as I said before, the array of names will be linked to this array key;
hierarchical– should the taxonomy we are creating have a hierarchy? Hierarchy means how list of pakistan consumer email much it is possible to report a child taxonomy, a bit like what happens with categories. If a taxonomy has a hierarchy you are creating a category , if it does not have one then you are creating labels ;
public– with this parameter we can decide whether to create a public taxonomy, that is, whether we want to show it with queries, or whether we want to create a taxonomy for internal use only;
show_ui– Do you need a user interface to manage your taxonomy?
show_admin_column– can I add the taxonomy column inside the post management page?
show_in_nav_menu– do I make the taxonomy available in the menu configuration?
show_tagcloud– with this last parameter we can choose whether to create a widget capable of generating a tagcloud or not.
At this point you have all the code you need to create and connect your taxonomy to the CPT you want; remember, all you have to do is add the correct abbreviation inside the second parameter declared in the function register_taxonomy().