public static function get_taxonomies() { if (empty(self::$taxonomies_array)) { //default taxonomies $taxonomies_array = array('category' => array('name' => EM_TAXONOMY_CATEGORY, 'ms' => 'event-category', 'context' => array()), 'tag' => array('name' => EM_TAXONOMY_TAG, 'context' => array())); //get additional taxonomies associated with locations and events and set context for default taxonomies foreach (get_taxonomies(array(), 'objects') as $tax_name => $tax) { $event_tax = in_array(EM_POST_TYPE_EVENT, $tax->object_type); $loc_tax = in_array(EM_POST_TYPE_LOCATION, $tax->object_type); if ($tax_name == EM_TAXONOMY_CATEGORY || $tax_name == EM_TAXONOMY_TAG) { $tax_name = $tax_name == EM_TAXONOMY_CATEGORY ? 'category' : 'tag'; if ($event_tax) { $taxonomies_array[$tax_name]['context'][] = EM_POST_TYPE_EVENT; } if ($loc_tax) { $taxonomies_array[$tax_name]['context'][] = EM_POST_TYPE_LOCATION; } } else { $tax_name = str_replace('-', '_', $tax_name); $prefix = !array_key_exists($tax_name, $taxonomies_array) ? '' : 'post_'; if (is_array($tax->object_type)) { if ($event_tax || $loc_tax) { $taxonomies_array[$prefix . $tax_name] = array('name' => $tax_name, 'context' => array()); } if ($event_tax) { $taxonomies_array[$prefix . $tax_name]['context'][] = EM_POST_TYPE_EVENT; } if ($loc_tax) { $taxonomies_array[$prefix . $tax_name]['context'][] = EM_POST_TYPE_LOCATION; } } } } //users can add even more to this if needed, e.g. MS compatability self::$taxonomies_array = apply_filters('em_object_taxonomies', $taxonomies_array); } return self::$taxonomies_array; }