Taxonomy Description WYSIWYG

On sites where we are using custom post type taxonomies, we often want to have archive page. The problem, is the description field for a taxonomy is a simple textarea field. WE WANT MORE! Here is the code needed to replace the “Description” textarea field with a WYSIWYG field.

This was stolen verbatim from qwerty qwerty over on WordPress StackExchange.

Force Parent Taxonomies

Taxonomies are fantastic, but for some reason there is no built in method for forcing WordPress to select all parent terms of a taxonomy if a user only selects a child / grand-child term. We found a sweet method to force any selected taxonomy to also select all parent taxonomies as well. Thanks to the WordPress Stack Exchange user Sisir for this sweet function.

 

Disable Taxonomy Archive

Sometimes we do not want our custom taxonomies to have archive pages. Lots of reasons for this, yet there doesn’t seem to be a good solution for this. I would love to see WordPress implement a ‘has_archive’ flag for taxonomies someday. Until then we can use this function to return a 404 for any taxonomy archives we do not want shown to users.

 

Using Multiple Taxonomies in ACF Repeater

I was trying forever to get a good way to allow a user to select from multiple different taxonomies in one ACF drop down. I eventually realized that is just not possible.

Instead, what we need to do is use a select field and populate it dynamically.

To do this, simply create a select field in your ACF. I ended up doing this inside of a repeater, like so:

p4bbkl49

Now we just need to populate this select field to simulate our taxonomy field. Here is the code for that:

There we go! Now you have a select field that allows the user to select between two ( or more ) taxonomies!

Show Taxonomies in Custom Post Type Admin

How did I not post this yet? If you have taxonomies tied to your Custom Post Types then you probably want those taxonomies to show up in the admin listing of those post types. Here is the code needed to do that.

This has been posted on various sites around the web so I cannot take credit for it, but I need it all the time and figured I would stick it here so I can find it easier.

CPT Taxonomy Function

I find myself creating taxonomies for a lot of my custom port types. I went ahead and setup a helper function to make it easier for me to create these taxonomies. A lot more could be done with this, but I find it covers 90% of what I need.