I hope this is alright to ask about on here, and I'm going to phrase it from a pure WordPress perspective, my dear forum moderators. I've previously asked the author. Plus I think it's a good, unique question for posterity.
I'm using a Select2 plugin with CMB2 and there is a function that allows you to query taxonomies (normally it just allows manually entered arrays).
OK, that's great, right? Yes, except the output if you wanted to place the selected data on a post, for example, is only the term ids. And here is where it gets a little trickier and why I am soliciting help...
...it doesn't actually connect back to the taxonomy when data is selected.
So to summarize the process:
- Terms are queried into the select2 field via a function
- The output after a selection is made are term ids, but they aren't looped back to the taxonomy. Let's call these objects.
What I'm trying to figure out: A function that says "if an object = term id, then return term name".
Also- the returned object is a numeric array, which I can easily implode. Plus I know WordPress automatically identifies individual metadata in an array (,, etc)
Edit: Figured it out like a boss. Answer below.