Problem: In a recent WordPress project we needed to provide an easy way for the site manager to locate the numerical ID associated with a custom taxonomy.
As WordPress developers we have a handful of methods at our disposal to recover that ID but those options are not always that easy to explain to our clients.
So let’s make it easier.
Solution: Add the Tax ID as a custom column in the WordPress admin.
In the first function we set up our new column with the header “ID”. We decided to filter the entire default list since you’ll notice that we also omitted the standard description column. For our particular use case we would not be using taxonomy descriptions so we decided to reduce the column clutter and remove it all together.
In the second function we go ahead and return our taxonomy ID for use in the new custom column.
Finally we use the appropriate hooks for adding and managing our custom columns.
The sortable column may not be useful as it just sorts the taxonomies by ID but I’ve included it here none the less.
In the end you end up with something like you see in the screenshot on the right, a much easier method for retrieving the ID associated with individual custom taxonomies.