Today i spent some time trying to figure how to get existing (and also used) tags from wordpress and using in admin panel as a combo box, for my brand new theme Wordnewz.
The return of get_tags() function was some kind of array but, because of my skills (not) in PHP i spend WAY too much time to go figure what to do. The initial result of get_tags() function is:
Array
(
[0] => stdClass Object
(
[term_id] => 28
[name] => Featured
[slug] => featured
[term_group] => 0
[term_taxonomy_id] => 29
[taxonomy] => post_tag
[description] =>
[parent] => 0
[count] => 6
)
)
And i only needed [name] and [slug]. Ofcourse, like a smart guy that i am, i pointed my browser on wordpress codex where i found… NOTHING. Nothing about this function… Great. Let’s try various stuff and google it for any ideas. And i found a PHP function get_object_vars for easy conversion. After this, all was GREAT. I use it like this:
$allTags = get_tags();
foreach($allTags as $thisTags) {
$thisTag = get_object_vars($thisTags);
echo '
\n';
}
And it WORKS like a charm. I posted this thing because i didn’t found too much references for stdClass Object or get_tags() WordPress function.

